Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Minimize database reads

 
Arjun Shastry
Ranch Hand
Posts: 1901
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am writing a web service(JAX-WS). One of the operation(submitData) requires web service to find how many more requests it should allow before it allows the current request. If there are already queued requests, then current request is rejected.

Client API may call submitData multiple times pro grammatically . In that case, first few requests might get accepted and some many not. For every request, we need database read(reading some count from mysql table).

Is there any way(cache etc) to minimize the database reads ?
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know the answer. Is it possible you can keep track of calls in your code by incrementing a number and decrementing them on return?
 
Stephan van Hulst
Bartender
Pie
Posts: 6503
83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds questionable. Why do you want to limit the requests by your web application? This is the job of the web application server.
 
Arjun Shastry
Ranch Hand
Posts: 1901
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
There are multiple web servers(say 10) on the front.(Its Axis web application on JBoss). So if one customer submits 50 requests, they will be load balanced. Keeping a track from web server level might be tough. After web server level , there is one Control server which will receive all these requests. This server will access DB to check currently how many requests are queued and hence how many more can be allowed. So DB read will be proportional to number of requests submitted.
 
Stephan van Hulst
Bartender
Pie
Posts: 6503
83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will probably want to filter this as soon as possible. Why can't the load balancing server handle this?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic