Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

How many FastCGI servers to use for Catalyst app?

by uG (Scribe)
on Feb 28, 2011 at 18:17 UTC ( #890616=perlquestion: print w/ replies, xml ) Need Help??
uG has asked for the wisdom of the Perl Monks concerning the following question:

Each of my Views has various thumbnails dynamically created and presented by a Catalyst::View::Thumbnail. But each image uses one of the FastCGI processes, so each request ends up using about 10 processes or more. How many processes should I use, or rather how should I determine the optimal amount?

Comment on How many FastCGI servers to use for Catalyst app?
Re: How many FastCGI servers to use for Catalyst app?
by ciderpunx (Vicar) on Feb 28, 2011 at 18:37 UTC
    • Are fastcgi processes actually the bottleneck?
    • How many visitors are you expecting?
    • How many are you expecting at a time?
    • How many requests would each visitor typically generate?
    • How much memory can you dedicate to running fastcgi processes?
    • How long does each process take to run (on average)?
    • Can you leave your users hanging round for a second or two?
    • What possibilities exist for caching images once they're generated and serving them up statically?
    Well, you get the idea. There's a lot you would need to know before anyone can give a helpful answer.

Re: How many FastCGI servers to use for Catalyst app?
by tilly (Archbishop) on Feb 28, 2011 at 19:57 UTC
    If you have scaling issues, your first step should be to put a reverse proxy up so that your FastCGI processes are not wasting time talking to slow clients.

    After you've done that, provision resources as follows. Figure out how big your FastCGI processes are. Decide how much RAM you wish to dedicate to FastCGI. The number of processes that you should spin up per box should be RAM/(size + some safety buffer). The number of machines you should have should be based on your peak usage plus some amount of headroom for growth, spikes, etc, with a fixed number of extra machines for failover in case a machine crashes.

    If you have less than a million dynamic pages/hour and a reasonably written application, odds are good that the number of machines you will need is more determined by provisioning for failover than it is by the resources needed to meet your load.

      Thank you tilly and sundialsvc4. Thats pretty much what I was looking for.
Re: How many FastCGI servers to use for Catalyst app?
by sundialsvc4 (Abbot) on Feb 28, 2011 at 20:14 UTC

    The process-count is really not the issue here, if there is actually an issue here at all.   The first question that I would have is ... “is anything actually hurting?”   (If not, you have No Problem.)   If there actually is pain, then you need to address that by simplifying the amount of work, e.g. by storing thumbnails in a database once they have been generated the first time.   The number of processes that might be “generating a thumbnail” is probably not going to be a significant issue, although if it is, that, too, is controllable.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://890616]
Approved by Corion
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2014-09-21 14:23 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (172 votes), past polls