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

  • Home
  • SEARCH
  • 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 501805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:13:38+00:00 2026-05-13T06:13:38+00:00

We have a web service which serves small, arbitrary segments of a fixed inventory

  • 0

We have a web service which serves small, arbitrary segments of a fixed inventory of larger MP3 files. The MP3 files are generated on-the-fly by a python application. The model is, make a GET request to a URL specifying which segments you want, get an audio/mpeg stream in response. This is an expensive process.

We’re using Nginx as the front-end request handler. Nginx takes care of caching responses for common requests.

We initially tried using Tornado on the back-end to handle requests from Nginx. As you would expect, the blocking MP3 operation kept Tornado from doing its thing (asynchronous I/O). So, we went multithreaded, which solved the blocking problem, and performed quite well. However, it introduced a subtle race condition (under real world load) that we haven’t been able to diagnose or reproduce yet. The race condition corrupts our MP3 output.

So we decided to set our application up as a simple WSGI handler behind Apache/mod_wsgi (still w/ Nginx up front). This eliminates the blocking issue and the race condition, but creates a cascading load (i.e. Apache creates too many processses) on the server under real world conditions. We’re working on tuning Apache/mod_wsgi right now, but still at a trial-and-error phase. (Update: we’ve switched back to Tornado. See below.)

Finally, the question: are we missing anything? Is there a better way to serve CPU-expensive resources over HTTP?

Update: Thanks to Graham’s informed article, I’m pretty sure this is an Apache tuning problem. In the mean-time, we’ve gone back to using Tornado and are trying to resolve the data-corruption issue.

For those who were so quick to throw more iron at the problem, Tornado and a bit of multi-threading (despite the data integrity problem introduced by threading) handles the load acceptably on a small (single core) Amazon EC2 instance.

  • 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-05-13T06:13:39+00:00Added an answer on May 13, 2026 at 6:13 am

    Are you making the mistake of using embedded mode of Apache/mod_wsgi? Read:

    http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html

    Ensure you use daemon mode if using Apache/mod_wsgi.

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

Sidebar

Ask A Question

Stats

  • Questions 272k
  • Answers 272k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Just add a loop which loops from the first to… May 13, 2026 at 1:55 pm
  • Editorial Team
    Editorial Team added an answer @Autowired is by-type (in this case); use @Qualifier to autowire… May 13, 2026 at 1:55 pm
  • Editorial Team
    Editorial Team added an answer Where does the error occur ? Is the SQLUserDataManager class… May 13, 2026 at 1:55 pm

Related Questions

We're neck deep in a project right now, schedules are tight (but reasonable). Our
we are designing the search architecture for a corporate web application. We'll be using
I'm designing a fairly small web application which will run on a Sun application
We're using CruiseControl.NET which invokes an MSBuild script. While debugging the build script, we
We're running a fairly complex app as a portlet on Websphere Portal Server 5.1

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.