• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Minimize database reads

 
Ranch Hand
Posts: 1907
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 15547
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 15547
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic