Question

I have a process running on eleastic-beanstalk packaged as a war file. The process is exposed via a web service , takes approx 5 mins to run and is CPU intensive. But the process always quits running after approx 1 minute. Is this because of the CPU work involved or the length it takes for the process to run ? Can these limits be increased ? I am a new user of EC2 and using the "free usage tier"

Était-ce utile?

La solution

It is most likely because Amazon ELB timeouts connections after 60 seconds if it is left idle (no data flowing). According to this answer, there is no way to change that yourself, but you can ask Amazon Support to change it for you.

Autres conseils

If you can run your process asynchronously, I would consider decoupling web service and the process with SQS. Same concept as Worker Environment Tiers, but on the same instance.

If you prefer to stay within "Free Tier", and have 750 hours of micro instance, then your Elastic Load Balancer is not beneficial to you, since it always forwards the request to the same instance. You can change your environment to "single-instance", and execute requests without timeouts.

I had this problem, was using a load-balanced environment and wanted to spread out load over several instances automatically.

In my case, the wait time was only a few seconds, but it was deemed to be too long for a good user experience in the web GUI, so I had to do something about it. Increasing timeouts were neither the problem, nor the solution for me.

First, I attempted to use JMS by deploying Apache MQ inside my WAR. Although this worked for testing/development purposes, when I started to scale, this didn't really sit well with the Elastic Beanstalk/EC2 model of doing things.

I contemplated using Amazon SQS, but didn't want to have to run things in an Amazon environment (especially in development).

What I ended up doing, was to create a "mini-JMS" implementation, based on a database queue (RDS) and comments in this JavaRanch article. This actually worked pretty well, both in development and now in production.

Your best way forward will probably be determined by whether it's acceptable for the user to wait while processing is performed, or not...

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top