WebFaction
Community site: login faq

I'm hosting a Django site with gunicorn (a master + 4 workers). I've settled with 4 because I've had good results in the past for the traffic I get, and "CPU cores * 2 + 1" just eats up my RAM.

Under normal usage, the gunicorn workers take around 45 Mb or RAM each, and I'm getting page load times of just under a second. Now, after sitting unattended for a few hours, the workers will go down to anything from 5 to 15 Mb of RAM each. If I visit the site at that point, it takes more than 10 seconds to get a response from the server. After browsing 2 or 3 pages, the workers go back to the normal memory usage and the site becomes speedy again.

According to this answer (see point 1), gunicorn should have the site ready to go at any time, without needing a "warm up" period after not receiving requests for a while. This is consistent with what I've seen when using this setup in at least a dozen other sites: gunicorn is simply there, ready to go at any time.

Is it normal for the workers to lower their memory consumption to such low levels? How can I get rid of the long response times after inactivity?

asked 10 Oct '15, 04:29

eRivas
114
accept rate: 0%


Try running some SQL queries to see if the issue is in the SQL and its caching mechanism, assuming you are using memcached or something. It is possible Gunicorn is waiting for the SQL, which takes its time depending on the size of the query, than once it is cached there is no issue.

permanent link

answered 10 Oct '15, 22:38

johns
5.4k412
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×910
×12

question asked: 10 Oct '15, 04:29

question was seen: 2,403 times

last updated: 10 Oct '15, 22:38

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM