The Only Reason My App Worked Was Due to a Slow Database
justinvincent.com
justinvincent.com
Requests should spend their time queued rather than letting the operating system thrash between processes, queues are stupid anyway in the context of webserving, they should use stacks as the best case scenarios are largely the same, and the worst case scenario for a stack are much better than a queue. (Yes, stacks are unfair, but it's better that a few people are served than no one in the event that the server gets bogged down.)
The issue is that the child pool now has too many children and the children spend their time thrashing, before it was acceptable because the children were mostly doing nothing. This sounds much more like an apache configuration issue than anything else. I wouldn't point the blame at 'fast' MySQL, but easy to misconfigure apache architecture.
Or simply frontend apache with nginx, and limit the number of backend connections. If you're using a fork/join apache which it sounds like are you, you'll get much better performance from this anyway. Setup this way apache can dump the output directly to nginx which can then spend time spoonfeeding it to the client.
Here is an example where I setup four MooTools Fx.Morph objects. Then I set up 400 divs that whose width will be modified using the next available Fx.Morph object in the queue. It is pretty simple, powerful stuff. Your objects must be reusable though so I dont think jQuery's built-in ajax/animations would work (I use this in "production" with MooTools' Request objects)
you simply get an instance of Pool, add your actions, by calling pool.act(fn). In your callback you'll receive one of the objects in the pool when it is ready. You use it, and when youre done, put it by by calling this.add(obj)
pool = new Pool();
pool.add(new ObjectInstance());
pool.act(function(obj){
//use obj and put it back
this.add(obj);
});No offense intended here... but it sounds like you could easily become the victim of a DoS attack. All that's needed is for someone to create their own front end and you'll be back to normal. Have you investigated some sort of solution on the server side, and not the client side?
well that's the point of ddos attack
Unless you know that you're doing CPU-heavy work in your apache procs (and it's unavoidable or already optimised), it seems that you could get back the responsiveness of your site?
It seems surprising that you're CPU-limited on the web head.
When I would persist a particular model back to mysql, I would fire off a job in Gearman, that would then grab the saved object and asyncronously send it off to lots of other sources.
After moving servers it would always send the previous state of the object. Having previously worked flawlessly.
Eventually I trackked it down to the fact that my Gearman job was being kicked off before the actual write to MySQL, so then when I did the select in my job process, it would grab the previous snapshot.
Pretty easy fix once I figured that out.
Update: I will never be without work.
ajax/get-accounts
ajax/get-streams
ajax/get-other-settings
ajax/store-client-view
ajax/get-tweets
ajax/sync-relationships
Shot in the dark: Is there some kind of sorting going on?