0

If DataBase only accept 20 requests at the same time, but in UI, We have 100 requests at the same time. How to resolve this in java?

Boxer Robert
  • 1,169
  • 2
  • 8
  • 14

2 Answers2

0

Your query should be look like this:

select * from table1 where ... fetch first 100 rows only

Or

You can use this logic

  • MaxActive: Maximum number of dB connections in pool. Set to -1 for no limit.
  • MaxIdle: Maximum number of idle dB connections to retain in pool. Set to -1 for no limit.
  • MaxWait: Maximum milliseconds to wait for a dB connection to
    become available. Set to -1 to wait indefinitely.
Tehmina
  • 205
  • 2
  • 8
0

As Elliott suggested you can use connection pool or object pool but you may experience performance issues. Next set of requests have to wait till the completion of first 20 requests. Alternatively, you can increase the number of db threads from 20 to 100.