mod_perl-1.26, threads and LWP.pm

2001-11-05 Thread Toni Andjelkovic

i will need to request an external URL multiple
(several hundred) times, where each request contains
a different arg. then i need to process each response:

http://foo/bar?arg=84375
http://foo/bar?arg=43896
http://foo/bar?arg=98945
...

the problem is that i need to do this from within a
single Apache/mod_perl process.

so i'd like to spin off about 10-20 threads and let
them handle the task concurrently by using LWP, join
on them, collect the response data and finally send a
summary to the client.

is this possible on mod_perl-1.26 (with 5.6.1, on either
Linux, FreeBSD or Solaris)?

what are the caveats?

if possible, one thread blocking for socket IO should
not block the entire Apache/mod_perl process. will perl
take advantage of kernel threads if the host OS supports
them?

is there anything special regarding perl/mod_perl/Apache
compilation (besides of -Dusethreads)?

should i use 5005threads (Thread.pm) or ithreads for
this task?

is LWP considered thread-safe?

thanks,
-- 
Toni Andjelkovic
[EMAIL PROTECTED]




Re: mod_perl-1.26, threads and LWP.pm

2001-11-05 Thread Ken Y. Clark

On Mon, 5 Nov 2001, Toni Andjelkovic wrote:

 Date: Mon, 5 Nov 2001 22:43:32 +0100
 From: Toni Andjelkovic [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: mod_perl-1.26, threads and LWP.pm

 i will need to request an external URL multiple
 (several hundred) times, where each request contains
 a different arg. then i need to process each response:

 http://foo/bar?arg=84375
 http://foo/bar?arg=43896
 http://foo/bar?arg=98945
 ...

 the problem is that i need to do this from within a
 single Apache/mod_perl process.

 so i'd like to spin off about 10-20 threads and let
 them handle the task concurrently by using LWP, join
 on them, collect the response data and finally send a
 summary to the client.

 is this possible on mod_perl-1.26 (with 5.6.1, on either
 Linux, FreeBSD or Solaris)?

 what are the caveats?

 if possible, one thread blocking for socket IO should
 not block the entire Apache/mod_perl process. will perl
 take advantage of kernel threads if the host OS supports
 them?

 is there anything special regarding perl/mod_perl/Apache
 compilation (besides of -Dusethreads)?

 should i use 5005threads (Thread.pm) or ithreads for
 this task?

 is LWP considered thread-safe?

 thanks,

I would like to unask your many interesting questions by asking if
it's absolutely necessary that the data being returned by your
processes has to be done through an HTTP request.  If you need some
large dataset that can be had by making all these requests, could you
not package up the logic into one module to do all the requisite
queryring (or whatever) and return you one large chunk of data?  If
the HTTP interface is absolutely necessary, I'd still question whether
you could make put all your logic into something like a SOAP
interface.

ky