简体   繁体   中英

HTTP Thread Pooling and JNDI Datasource Connection pools

I'm looking for some best practice and advice on how to configure the thread pool in jboss/wildfly for processing http requests when compared with the size of a connection pool of a JNDI data source.

Although there are other web apps running on the server, a new web services application uses Spring security for authentication, which calls my database via a JNDI retrieved JDBC datasource. If an exception is thrown whilst authenticating, Spring security interprets that as an authentication failure and returns a 401, which makes sense.

We have throttling implemented as a custom Spring security filter, which works on a user by user, endpoint by endpoint basis, and requires the authentication look up before it is applied.

When hammer the service with jmeter to test the throttling, I start to see 401 responses coming back, because there are no more JDBC connections available. Essentially jboss/wildfly has enough HTTP threads to handle the requests, but not enough JDBC connections to match.

I'm reluctant to increase the datasource connection pool to match the HTTP thread pool as that seems stupid. I was wondering if there is any best practice around this issue. For the moment I'm thinking that adding something extra to the Spring security exception handling to check the exception that's thrown and return a 503 if it's out of JDBC connections instead.

理想情况下,您的http线程将等待db连接池返回连接对象,因此检查等待时间可能很小。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM