I have a django site. I did a quick test, and created a url which is requested a lot (doesn't matter how for this question). I've checked the apache frontend access log, I see a lot of 502 errors. Also, my website is somewhat freeze when all these requests arrive. Is the reason is the high traffic? If so, what can be done for a website to handle that? since I assume it does not relate to django code, since in this url there are no db queries, or anything special. just return a string. And another question, in the frontend logs there are a lot of log files, does they somehow get cleaned/created automatically? Some explanation would be helpful. asked 24 Nov '16, 18:46 clip |
The error message that you've quoted is from the front-end Nginx log. For possible errors from your Django app, you should refer to your app's error log in Regarding old logs, we rotate logs every day and keep a seven day history. answered 24 Nov '16, 23:18 seanf I dont see a special error in this log. I don't see an error in my django app (in my own code). The server still hangs during the high traffic. Is it possible the server just can't handle this? Does upgrading to cloud/other plan can help?
(25 Nov '16, 01:00)
clip
It could be that you simply want to increase the number workers and threads available for processing requests. That document describes how to reduce the number of available processes to help reduce memory consumption, but you can likewise increase the number of processes to allow more requests to be handled at once.
(25 Nov '16, 05:35)
ryans ♦♦
Should I increase the number of process, threads, or both? What is a reasonable number to set for a site that's say, hit 100K visits in a few minutes? no expensive queries or anything else, just simple serving of pages that maybe based on a very simple query. If the pages are static, is there a big benefit to use just the static app instead? (this is not entirely the case though, just asking)
(25 Nov '16, 07:47)
clip
The official mod_wsgi documentation suggests processes over threads unless the application is primarily I/O bound. I can't speculate as to what actual number of threads makes the most sense -- it depends on a lot of factors, including how much RAM each thread might consume on average and how long various tasks take on this particular hardware. The best way to determine this through benchmarking and measuring the effects of various configurations. A static media application (such as "
(25 Nov '16, 10:09)
ryans ♦♦
So I'll guess I'll just try to increase the process number. Since I don't know how much power (in terms of traffic) a process worth, it will be a total guess. Not even a guess for a django high traffic simple url which serves a plain text? How can I measure the performance difference when I change the numbers?
(25 Nov '16, 10:41)
clip
No, sorry.
You can use any tool that generates traffic to a URL on your site. A couple of options are:
Whichever method you use, you can then look through the results and through your own logs to see how the site performed during the test.
(25 Nov '16, 17:56)
seanf
How can I install the ab tool? I've tried apt-get install apache2-utils.
(26 Nov '16, 15:39)
clip
The 'ab' command is already installed on our servers, so you just need to execute it from the command line via SSH.
(26 Nov '16, 22:43)
NickR ♦♦
showing 5 of 8
show 3 more comments
|