I set up discourse on a instance that contains 8GB of memory and a quad-core processor on Microsoft Azure, and I run into HTTP 502 problems these days. Especially when there are about 200 to 300 registered users visiting at the same time, the server goes wrong with HTTP 502 error. The server logs shows memory usage and CPU usage are high (above 90%) during peak times.I guess that is because each connection takes up too much resource, but I don’t know how to optimize.
So I wonder what I can do to resolve this, except upgrading hardware configurations. Thank you for any advice!
@pfaffman Thanks for your advice.
I have set ‘db_shared_buffers’ to 4096MB in app.yml and rebuild. The problem seems to occur less frequently after making that change, but still remains unsolved.
If my calculations are correct, the size of database should be 9.72GB.
When the last time HTTP 502 error occured, the server received about more than 270,000 requests from 789 ips in 2 hours.
I got these two numbers using the command below:
Was thinking about the load here vs the DB size 135k reqs an hour is probably a lot especially if this is peaking in some times at say 1000/sec due to the way traffic works.
Though step 0 here @xuchao_007, get a CDN in place so you can get a good breakdown of dynamic vs static requests. Unclear how much of this traffic is serving images vs the server doing work.