Avatar ·

What to deploy a high-load website on (Python, MySQL)?

📁 Advanced Python Topics, question, django, work

There is a working website written in Python (Django) with a MySQL database.
Since the developers didn't put much effort into writing optimized code, the site turned out to be very heavy. With a daily traffic of tens of thousands, during peak times the server can't handle the load and drops those it couldn't serve.
Here is the physical server system:
1. 2 cores at 1.8GHz
2. RAM 2GB

Here is what the server is currently deployed on:
mysql + nginx + fastcgi

So the question is: I'd like to hear the opinion of experienced, seasoned, or just knowledgeable people on what else this site can be deployed on to make it as fast and resource-efficient as possible? Or is this stack the fastest? Maybe someone has done performance comparisons.
Also, is it possible

Avatar ·

In general, this violates Django's logic. It suggests passing the Request object manually, and yes, doing Client.objects.filter(user=request.user). If this is done many times, you can wrap it in a function:

# models.py...def own_clients(request):    retu Client.objects.filter(user=request.user)...

And, accordingly, use it:

# views.pyfrom .models import ..., own_clients...    ... = own_clients(request).all()

Log in to leave an answer

Blogs