S
S
Stepan2019-11-09 18:50:48
Django
Stepan, 2019-11-09 18:50:48

The site on Django 2.2 is slow for 800 simultaneous users, how to optimize?

A Django 2.2 site with one page and a form that needs to be filled out and submitted to receive a response to the action.
When there were 100+- simultaneous visitors, the site loaded in 2-3 seconds and the form worked quickly.
Now, on average, 800 visitors at one moment of which I make 250 requests per minute.
The process is as follows, the user entered a request into a line and pressed a button that sends a POST request to the back, and the back sends a POST request to an external API, and returns the response back to the user.
Right now the page load time is about 10 to 20 seconds just on opening the page.
I want it to be around two seconds like before.
VPS server
- CentOS 7 - one core at 2.5 hertz - 1GB of RAM
RAM is always 30% full
Processor loading rarely jumps up to 80%, on average 10% -20%
What can be done to correct the situation? In which direction to dig?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Kitaev, 2019-11-09
@deliro

Increase the number of workers. Try threads first, then processes. Then eventlet, if there is nothing exotic.

D
Dr. Bacon, 2019-11-10
@bacon

The process is as follows, the user entered a request into a line and pressed a button that sends a POST request to the back, and the back sends a POST request to an external API, and returns the response back to the user.

The case when everything spoils synchronism, there are two options: simple and complex
Complex - work with an external API is put into the background, this is celery or similar task queues.
Simple - since the logic of the service is very simple, it can be easily rewritten to an asynchronous engine, aiohttp or similar.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question