0

We have a Spring-based application with multi-tier architecture.

Layers are in this order

Rest
Service
DB Layer

All bundled in a .war file and deployed inside Apache Tomcat 7

We have Rest APIs which does some series of work in the service layer and return response.

For Example:

Policy Push API will do compliance check, validate and push data and record in DB and show msg to user. This process takes about 2 sec min.

Few Days back our server started to crash. On inspecting we found we were hitting around 2000 request/sec which tomcat couldn't handle.

To overcome this we have added Nginx Loadbalancer with 3 instances.

It is stable to some extent but I feel its just a fix.

I was looking into Kafka, RabbitMQ as an option. But in that case, issue will be Request will be added in queue and response is returened to User.

We need to show Policy status in real time.

By adding it in queue its, not gurantee that Policy is pushed.

It would help if someone could help with this Usecase how to handle?

Whether adding more server to load balancer is the only option or something else?

MyTwoCents
  • 7,284
  • 3
  • 24
  • 52
  • Spring doesn't require Tomcat, it has an embedded HTTP server. I would try that alongside Nginx or HAProxy. Your application will need to be better instrumented with tracing, metrics gathering and, logging, for example, to find the real bottleneck, though... If you want to have website reflect statuses in real time, look into Couchbase or RethinkDB – OneCricketeer Dec 19 '18 at 04:40
  • Thanks for the suggestion. We are using some of the feature provided by Tomcat like session replication when running multiple instances in a cluster. Not sure how we will do that in case of embedded Tomcat for example. We also have tracing, metrics gathering and logging which ends up showing details on a Grafana Dashboard. So my tale from your comment would be adding up more instance to cluster is one of the ways. – MyTwoCents Dec 19 '18 at 04:55
  • I haven't used Tomcat in a few years, but I remember there being something about Catalina opts, and the heap size might need set there... Other than that, it just sounds like a tuning problem, and if the resources are capped, then add mode instances, sure – OneCricketeer Dec 19 '18 at 06:25

0 Answers0