• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Minimize database reads

 
Ranch Hand
Posts: 1907
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 ?
 
Bartender
Posts: 598
26
Oracle Notepad Linux
  • 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?
 
Saloon Keeper
Posts: 10767
229
  • 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: 1907
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
Saloon Keeper
Posts: 10767
229
  • 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?
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!