On Wed, Dec 26, 2001 at 12:57:59AM -0500, Jason Boxman wrote:
> If design a session to, say, talk to a remote HTTP server and return data, 
> does it make sense to daemonize it or to simply start a new session of 
> (object instance) for each request (I expect to be making hundreds)?

Only hundreds? :)

POE::Component::Client::HTTP is a "daemon" component that does
user-agent things on behalf of other sessions.  The client sessions
post requests to it, and it posts responses back as they arrive.

PoCo::Client::HTTP performs all its requests in a single session.  It
stores SocketFactory and ReadWrite wheels with their corresponding
requests.

> Is there some logical reason why one method's better than the other or is it 
> simply a matter of personal taste?

Chris Fedde has a good point: network overhead often dwarfs library
overhead.

That said, the method that must do more work usually takes longer.  If
you need speed, avoid creating and destroying sessions if you can.

> I used httpd.perl as a template, so I'm employing the latter technique 
> presently.  Is the former or some other technique a better approach?

Two HTTP client components are already written.  Have a look at
POE::Component::Client::UserAgent and/or ::HTTP.

> Would it make sense to retain the original SocketFactory listener session and 
> add a single daemonized session to handle requests and post the results to 
> another daemonized 'saver' session?

Wait, listener?  Are you writing a client or a server?

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sourceforge.net

Reply via email to