Re: FastCGI multithread programming problems
Artyom <artyomtnk-/[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel,gmane.spam.detected |
|---|---|
| Message-ID | <[email protected]> |
Hello, First of all: 1. Yes you can use many threads There are several examples for this technique in FastCGI sources. The main idea: you listen on socket and wait for the request. After you "accept" it you get ann independent socket you work with it - so you have an independent thread to deal with it. 2. There examples in Fcgi sources proposes usage of mutex with accept. I think this is not the best way to do this. Nowdays I work on C++ Web Development Framework that uses FastCGI protocol as a base. I implemented there a thread pool technique when the major thread accepts requests and passes them to worker threads. You can find and example of such usage at cppcms.sourceforge.net Look at http://cppcms.svn.sourceforge.net/viewvc/cppcms/framework/trunk/ Files thread_pool/worker_thread Several notes: 1. You should not work with millons of requests in same time - server does the job for you. You need only create a page 2. Asynchronous technique is quite problematic for web development because of 3rd pary API that do not support it. NOTE: I'm not big specialist in FastCGI however I use it and implemented a framework that is still on early development stages. I use thread pool technique and work with lighttpd web server. Artyom http://cppcms.sourceforge.net/ C++ Web Development Framework --- Harvy Chen <[email protected]> wrote: > Dears, > I'm developping a project which has a communication > channel(based on HTTP > protocol) to recevie request from clients(Maybe > million clients), the > platform is under linux, > now i'm trying use FastCGI to provide a high > performance process capacity, I > wonder know if the fastcgi can support > multi-threads, i means in one cgi > process, > i create a thread pool to handle the request, But i > looked up in the > internet, found that just one rquest will transport > to a cgi process to > handle at the same time, > means the thread pool will be useless. Maybe i'm > wrong, will anybody can > give me correct answer? > > If the fastCGI can support aync processing, it's > perfect to me. > > ___________________________________ > fastcgi-developers mailing list > http://fastcgi.com/fastcgi-developers/ > Delete Reply Forward Spam Move... Previous | Next | Back to Messages ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/