This short post specifically targets:
– RoR as web development environment – Can be ignored as this is closely related to nginx configuration settings
– Nginx as web server
While working with ElasticBeanstalk environments, one of my requirement was to send a heavy job to Worker App that takes > 1 min (60 seconds) to complete and I had no configuration in place. The way beanstalk-app was handling that job was disappointing. That job never finishes within a minute and another job (duplicate) gets triggered by the app and this goes on till it reaches the max retry count.
I tried googling the solution and found that we have to increase the timeout
for the web server which is handling the request. In my case it was `nginx
`.
So I decided to write a config file under `.ebextensions/02_nginx_proxy.config
` — I am not going into the details of `ebextensions
` here as this is out of scope of this article.
Here’s how my config file looks like:
https://gist.github.com/puneetpandey/d3781ca1d5e9c703c3d1c11846eb3f1a
Here if you focus on lines:
`proxy_send_timeout 600;
`
`proxy_read_timeout 1h;
`
`send_timeout 600;
`
This will prevent sending multiple requests of same job type until the current one finishes in 1h.
If you need any inputs on what other lines are all about/doing, then leave your comment.
Happy Coding!