[FASTCGI] very low performance

Igor sprog at online.ru
Wed Jan 27 12:39:37 EST 2010


Hello Evgeny,

Wednesday, January 27, 2010, 3:05:40 PM, you wrote:

   Hmm, make sure you have all requests coming to this process, instead
   streaming the picture print PID and the counter of
   requests. Make sure that the same PID serves as many requests as
   you want. The PID should stay the same but the request counter
   should increase. That's normal. What do you see in your case?

   When you do not load the picture, is there any performance change?

   Check out apche error log, is there any message related to crashing or
   sigterminate?

   If everything is OK, check out your compiler options, does it have
   the threading support?

   http://ozten.livejournal.com/

   Try out this sample,

FastCGI

-- ghc -package fastcgi -threaded --make -o FCgiPlay.fcgi FCgiPlay.hs 
import Control.Concurrent
import System.Posix.Process (getProcessID)

import Network.FastCGI

test :: CGI CGIResult
test = do setHeader "Content-type" "text/plain"
          pid <- liftIO getProcessID
          threadId <- liftIO myThreadId
          let tid = concat $ drop 1 $ words $ show threadId
          output $ unlines [ "Process ID: " ++ show pid,
                             "Thread ID:  " ++ tid]

main = runFastCGIConcurrent' forkIO 10 test

does it work fast?


 


ET> Hello, Igor, thank you for detailed explanation!

>> Since you've done very badly in programming your first FastCGI app,
>> you're making the server to run through steps 1 to 6 PLUS FastCGI
>> overhead which in the first time is significant. That's why
>> you have such a bad performance out of a sound technology.

ET> But I'm afraid that my program has the loop. 'runFastCGIConcurrent' function listen webserver's requests and launches 'cgiMain' for each one.

ET> Network.FastCGI module uses not different processes for processing requests but posix threads. 

ET> I have checked my program's behaviour, it can serve many requests in some time with 'FastCGIConfig -maxClassProcesses 1' option in webserver's config.
ET> There is only one myprogram.fcgi system process with immutable pid in that time.
ET> _______________________________________________
ET> FastCGI-developers mailing list
ET> FastCGI-developers at mailman.fastcgi.com
ET> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers



-- 
www.rol.ru
Best regards,
 Igor                            mailto:sprog at online.ru



More information about the FastCGI-developers mailing list