Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8639283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:57:43+00:00 2026-06-12T10:57:43+00:00

I just moved from apache prefork to worker and started running mod_wsgi in daemon

  • 0

I just moved from apache prefork to worker and started running mod_wsgi in daemon mode. So far, so good. I haven’t experienced max load yet, but the server seems more consistent and we’re not seeing random requests take 2min waiting for a mod_wsgi response. Memory footprint has gone from 3.5G to 1G. This is awesome. We’re running on a single VPS with 6G of ram. There’s one Django app running on this sevrer along with an instance of memcache, to which we’ve allocated 1G of ram. We have a separate MySql server.

Our application is bulky and can certainly be optimized. We’re using NewRelic to troubleshoot some of the more slow running pages now. I’ve read a lot on optimizing mod_wsgi/apache but, like everyone else, I’m still left with a few questions.

Our average application page load time is 650-750ms. A lot of our pages are in the 200ms range, but we’ve got some dogs that take 2-5+ seconds to load. We get around 15-20 requests/second during normal load times and 30-40 requests/second during peak times, which may last 30-60 minutes.

Here’s my apache config, running worker mpm.

StartServers        10
MaxClients         400
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0

I started out with the defaults (StatServers=2 and MaxClients=150) but our site slowed way down under minimal load. I’m guessing it took a long time to spin up servers as requests came in. We’re serving 90% of our media from s3. The other 10% are served through Apache on our https pages or someone pointing lazily to our local server. At nominal load, 15 worker processes end up being created, so I’m thinking I should probably just set StartServers=15? With this configuration I’m assuming I have 15 worker processes running (which I can confirm with NewRelic) with 25 threads each (which I don’t know how to confirm, guessing 400/15).

My apache/mod_wsgi directives look like this:

<VirtualHost *:80>
    # Some stuff
    WSGIDaemonProcess app1 user=http group=http processes=10 threads=20
    WSGIProcessGroup app1
    WSGIApplicationGroup app1
    WSGIScriptAlias / /path/to/django.wsgi
    WSGIImportScript /path/to/django.wsgi process-group=app1 application-group=app1    
    # Some more stuff    
</VirtualHost>

<VirtualHost *:443>
    # Some stuff
    WSGIDaemonProcess app1-ssl user=http group=http processes=2 threads=20
    WSGIProcessGroup app1-ssl
    WSGIApplicationGroup app1-ssl
    WSGIScriptAlias / /path/to/django.wsgi
    WSGIImportScript /path/to/django.wsgi process-group=app1-ssl application-group=app1-ssl
    # Some more stuff
</VirtualHost>

Having a different WSGIDaemonProcess/WSGIProcessGroup for the ssl side of my site, well, that just doesn’t feel right at all. I’m 100% sure I’ve mucked something up here. To the greater point though, I’ve allocated 200+40 threads for mod_wsgi to handle requests from Apache, leaving 160 threads to deal with whatever media needs to be delivered up (through ssl or laziness of not pointing to s3).

So given our application load above, can anyone suggest ways I can improve performance of my site? Am I dealing with the ssl/mod_wsgi directives properly? Where’s Graham? 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:57:45+00:00Added an answer on June 12, 2026 at 10:57 am

    See discussion at:

    https://groups.google.com/forum/?fromgroups=#!topic/modwsgi/Hakr6FjRVQM

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started with WPF. Moved from Window Form. Where do those openDialog, saveDialog
I have just moved my code over to a new server (running on Apache
I just moved from Visual Studio 2008 to Visual Studio 2010 (final) and noticed one major
So i have just moved everything from my localhost to a new online server
I've just moved over from shared to dedicated hosting, and suddenly POST is not
I have just moved a site from a dedicated server to a GoDaddy shared
We just moved over to Git from SVN. In trying to clean up some
I just moved a web app project from VSS to TFS and when I
I just moved a django project to a deployment server from my dev server,
Having just moved from textmate to vim I'm curious. To be able to navigate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.