Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advice on counting web service hits

Status
Not open for further replies.

jshurst

Programmer
Oct 27, 2004
1,158
US
I am currently trying to create a web service infrastructure at my work. What I mean is that I want to create some generic web services that a lot of projects can consume. I'm in the early stages of this and currently I have one service (for querying Active Directory).

Do you guys suggest that I just use built in performance counters (Server 2K3) or should I log each request. Also, if I log each request I was going to do it with an xml file and log each 20 (or so) hits using a Application() variable (using a database will make me go through a lot of red tape).

I need some advice on this. Do you think I should worry about logging or just forget about it? Also, do you think I should just count the hits or log things like ip address, application name (could be passed over as a param), etc? Also I've heard that the Application() variable can cause some concurrency issues and that using the locking method incures overhead. Do I need to worry about that? Just looking for advice.

Thanks,

J
 
1st you need to ask why you need to count the hits. If it's required then do so, if not, don't worry about it.

Is logging required?
Yes: use Log4Net and NLog libraries, don't roll your own.
No: Don't worry about it

What information needs to be logged?
with Log4net (and maybe nLog) you can create custom attributes. hook these attributes into the context request handlers and logging is done simply by making a request to the service. no need to litter your service with logging requests.

here are two posts on logging the number of sql queries per page. it would be simliar for you except you will log to a text file, and you will just count hits, not sql queries.
Measuring NHibernate's Queries Per Page
Performance Logging

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks for the advice. I'll probably just forget the logging. It is really more of a curiosity thing for me. I want to see how many requests are being made. I'll probably just turn on some performance counters and check out the load from time to time.

Thanks!

J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top