Closed sgyyz closed 1 year ago
some findings: it's better to add the jersey-apache-connector
to benefit the connect pool feature from it.
Refer to: http://www.theotherian.com/2013/08/jersey-client-2.0-httpclient-timeouts-max-connections.html
more reference LogglyBatchAppender
from org.logback-extensions:logback-ext-loggly.
It's easy to rewrite the getHttpUrlConnection
and processEntries
methods to customize the request with Authorization
and the request body content format.
For what it's worth, Jetty's HTTP Client is quite similar to JAX-RS's and it's supposed to scale very well.
Thanks @sgyyz for bringing this up 🙌
In version 0.3.0
JAX RS will no longer be used (see #13). I'll do some testing and should it be merged and released in no time.
Hope this helps! 🙂
What
The performance is good when we did the local testing, but when we push to our test environment, there are 5~8 users are doing the requests at the same time, our target server became slow and slow. And revert the logback-logtail as our log dependency, everything backs to normal. 🤣
Why
After doing some research, it was caused by the JAX RS
Client
.As we can see the
client
is a "singleton", it can not deal with massive requests at the same time. It likes our application has one database connection to process the massive user queries.I suggest:
Feign
orRestTemplate
, it will be helpful for these users not bringing theJAX RS
andJersey
related dependencies.