Re: crating new threads in http session
Jan Wielemaker <[email protected]> Mon, 21 Apr 2014 16:20:47 +0200
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 04/18/2014 10:45 PM, Josef Fydl wrote: > I have Web server running and handling multiple request, each request > does lot of we queries and it is slow, So I wanted to run parallel > using thread_create. Test outside of web server showed a great > improvement. But it looked like thread_create doeas not work inside > http session in server. Did anybody solved the same problem and how, > In other word can one http request be handled by up to 8 thread? and > how? It is perfectly fine to create threads from an HTTP handler. Just, it should be the initial handler thread that sends back the result to the client because it has its I/O setup specially to cooperate with the HTTP server infrastructure. So, the other threads should send their (partial) data to a message queue. If you can, use the high level concurrent/3 and concurrent_maplist/N predicates. Cheers --- Jan > > Thanks Josef Frydl _______________________________________________ > SWI-Prolog mailing list [email protected] > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog >