基于Django的应用程序可能会失控 - 我该如何扩展它?

时间:2021-03-13 09:18:05

I need some guidance in the realm of server architecture for Django.

我需要在Django的服务器架构领域提供一些指导。

My current Django-based web app stats (reached in two weeks - run on one VPS w/ Apache, mod_wsgi, mysql):

我目前基于Django的网络应用统计数据(在两周内完成 - 在一个VPS上运行,带有Apache,mod_wsgi,mysql):

  • 10,000 users total
  • 总共10,000个用户

  • 20 avg requests/user/day
  • 20个平均请求/用户/天

  • 200,000 requests/day
  • 8,000 users access site daily
  • 每天有8,000名用户访问网站

Where the app could reach (where I'd be panicking - this assumes approx linear growth):

应用程序可以到达的地方(我恐慌的地方 - 这假设大致线性增长):

  • 200,000 users total
  • 总共200,000个用户

  • 20 avg requests/user/day
  • 20个平均请求/用户/天

  • 4,000,000 requests/day
  • 160,000 users access site daily
  • 每天有160,000名用户访问网站

The issue here is really just handling page requests. I only store short strings of text-based data, so DB size shouldn't be an issue.

这里的问题实际上只是处理页面请求。我只存储短字符串的基于文本的数据,因此DB大小不应成为问题。

What sort of server architecture should I be setting up from a hardware and software perspective? I need to think about caching, load balancing, multiple processing servers, multiple DB servers, etc, but don't know where to start.

我应该从硬件和软件的角度设置什么样的服务器架构?我需要考虑缓存,负载平衡,多个处理服务器,多个数据库服务器等,但不知道从哪里开始。

1 个解决方案

#1


1  

You're projected growth of ~45 / requests per second really isn't that intensive. I think using a standard nginx load balancer in front of your web servers will handle everything. If your DB access isn't very intense you will probably do fine with just 1 DB machine.

你预计每秒45左右的增长确实不是那么密集。我认为在Web服务器前使用标准的nginx负载均衡器可以处理所有事情。如果您的数据库访问不是非常激烈,那么只需1台数据库机器即可。

I really think the most important thing is not to do any premature optimization. Deal with issues as they come, or else you may end up wasting a lot of time.

我真的认为最重要的是不要做任何过早的优化。处理问题,否则你可能会浪费很多时间。

There are tons of caching, multiple server configurations, and load balancing tutorials.

有大量的缓存,多个服务器配置和负载平衡教程。

Google is a good place to start.

谷歌是一个很好的起点。

Growing traffic is a standard problem, there are no lack of tutorials on these things.

不断增长的流量是一个标准问题,这些东西不乏教程。

#1


1  

You're projected growth of ~45 / requests per second really isn't that intensive. I think using a standard nginx load balancer in front of your web servers will handle everything. If your DB access isn't very intense you will probably do fine with just 1 DB machine.

你预计每秒45左右的增长确实不是那么密集。我认为在Web服务器前使用标准的nginx负载均衡器可以处理所有事情。如果您的数据库访问不是非常激烈,那么只需1台数据库机器即可。

I really think the most important thing is not to do any premature optimization. Deal with issues as they come, or else you may end up wasting a lot of time.

我真的认为最重要的是不要做任何过早的优化。处理问题,否则你可能会浪费很多时间。

There are tons of caching, multiple server configurations, and load balancing tutorials.

有大量的缓存,多个服务器配置和负载平衡教程。

Google is a good place to start.

谷歌是一个很好的起点。

Growing traffic is a standard problem, there are no lack of tutorials on these things.

不断增长的流量是一个标准问题,这些东西不乏教程。