1

We have 2 services front end api service and a backend service. In order to get high tps we are using async calls.

  1. End user http call lands on one of the tomcat servers in frontend
  2. The frontend calls backend in Async with the context of the server ip and puts the request thread to sleep
  3. Once backend finishes the job it makes a callback to frontend using rmi with the server ip it got in context
  4. In the callback the original http thread is invoked.
  5. The invoked http request thread consumes the prepared data from cache and completes the response.

This was fine till we were in physical DC as we used to not scale or de-scale. With AWS ASG the server ip might not exist by the time backend service tries to make a callback. Due to this the request at the user end needs to get retried.

We want to get out of RMI here and still remain async. Would like to get any solutions for this

Dheerendra Kulkarni
  • 2,728
  • 1
  • 16
  • 18

1 Answers1

0

Get rid of your response thread altogether. Have the client poll the cache for the full response statelessly so that you don't need state maintained in the middleware (tomcat). Stick your responses in ElastiCache or Redis from the backend, and when they show up the client will find them.

If you want to avoid the poll all the way from the client, you can do long-waits in the middleware, but still, make them stateless and have them poll the cache on a timer, but really you are just making another choke-point, you are better off fully stateless.

Rob Conklin
  • 8,806
  • 1
  • 19
  • 23