服务器软件选择Django live / staging [英] Server software choice for Django live/staging

查看:142
本文介绍了服务器软件选择Django live / staging的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了开发我们的Django网络应用程序,我想转到一个自动系统,该系统自动更新与应用程序的实时版本具有近似相同属性的应用程序的暂存副本的源(从VCS)。这样做的一般想法已经在这里被覆盖了。#625256 。 Django文档还会讨论设置虚拟主机在同一个Apache上托管2个Django实例。我需要设置的许多项目已经到位了。

For developing our Django web app, I'd like to move to an autonomous system that automatically updates the source (from VCS) of a staging copy of the app which has near identical properties to the live version of the application. The general idea of doing this has already been covered here on SO #625256. The Django documentation also talks about setting up virtual hosts to host 2 instances of Django on the same Apache. Many of the pieces I need to set this up are already in place.

我的问题具体 - 如果这个设置将会是什么服务器软件,我应该选择在Windows Server 2000下运行

What my question specifically -- What server software should I choose if this setup will be running under Windows Server 2000?

Apache + mod-wsgi似乎是自然的选择,但根据本博客由Graham Dumpleton mog-wsgi在Windows上运行的Apache不要重新加载它的个人进程,需要重新启动整个Apache服务。这是一个 no-go ,因为当我们更新分段代码时,我不希望实时网站退出。

Apache+mod-wsgi seems like the natural choice, but according to this blog post by Graham Dumpleton mog-wsgi on Apache running on Windows can't reload it's individual process and needs to restart the whole Apache service. This is a no-go as I don't want the live site dropping out whenever we update the staging's code.

什么是最好的选择这种情况的服务器软件?

What is the best choice of server software for this situation?


  1. 维护2个可以独立重新启动的Apache副本(这感觉很糟糕) em>?

  2. 迁移到Apache以外的其他东西?

  3. ???


推荐答案

在使用Apache时,Windows上没有个别进程,只有一个Apache工作进程。此外,Windows上还没有守护进程模式。无论如何,这一切都意味着,Django实例都在一个进程中运行,尽管在不同的子解释器中。那么是的,为了导致一个Django站点的代码被重新加载会对另一个站点造成影响,因为它们在同一个进程中。

There are no 'individual processes' on Windows when using Apache, there is only one Apache worker process. Also, there is no daemon mode on Windows either. Anyway, what it all means is that both Django instances do run in the one process, albeit in different sub interpreters. So yes, to cause code for one Django site to be reloaded will have impacts on the other site because of them being in the same process.

如果一个在UNIX上系统可以向worker / daemon进程发送kill信号,他们将重新启动而不重新启动整个Apache。在UNIX上,即使在与接受HTTP请求的端口的侦听器套接字相同的过程中的多个站点始终保持打开的情况下,也不会导致问题,因此在重新启动期间到达的后续请求只是排队并将被处理一次工作人员/守护进程正在重新运行。

If one was on a UNIX system one could send a kill signal to the worker/daemon processes and they would restart without restart whole of Apache. On UNIX this does not overly cause problems even when multiple sites in same process as the listener socket for port on which HTTP requests are accepted is maintained open at all times, so subsequent requests which arrive during the restart just queue up and will be handled once worker/daemon processes are running again.

在Windows上,正确接管Apache必须重新启动。这意味着,如果这么长时间,监听器套接字将被关闭,并且会有一个小窗口,其中请求将会导致连接失败。这个窗口多长时间真的需要做一些测试。通常这不是一个巨大的问题,因为足够短,这个请求在这个确切的时刻会遇到的概率很低。换句话说,如果你只是在谈论一个不期望重新启动的阶段环境,你可能会过分担心。如果您尝试在同一Apache实例上运行一个开发站点,那么这将是一个问题。

On Windows as you rightly pick up the whole of Apache has to be restarted. This means that for ever so small a time that listener socket will be closed off and there will be a small window where requests will get a connection failed. How long a window this is you will really need to do some testing on. Usually it isn't a huge problem as is short enough that low probability that request will hit at that precise moment. In other words, you may be unduly worrying if you are only talking about a staging environment given that wouldn't expect to restart very often. If you were trying to run a development site on same Apache instance then that would be a problem.

所有这些都表示,如果您希望分段实例与可能生产然后仍然需要运行Apache,因此不同端口上的多个Apache实例将只是逻辑解决方案。您可以在CherryPy WSGI服务器或者粘贴WSGI服务器和代理服务器上运行Django,但是它是不同的托管系统,并且在不太可能会遇到最终会在生产设置时会出现的问题上发挥作用。

That all said, if you want the staging instance to be as close as possible to production then would still need to be running Apache so multiple Apache instances on different ports would be only logical solution. You could run Django on top of CherryPy WSGI server or Paste WSGI server and proxy to it, but then it is a different hosting system and will behave differently to the extent that you may not pick up issues which would ultimately occur when on production setup.

所有这一切,我建议您实际做一些测试,您可以在Apache上运行基准测试,并同时执行重新启动,并查看有多少请求失败。这将有助于您了解是否是您认为的大问题。

All up, I would suggest you actually do some tests where you run benchmarks against Apache and perform a restart at same time and see how many requests fail as a result. This will help you understanding whether it is the big problem you think it is.

这篇关于服务器软件选择Django live / staging的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆