[Catalyst] working around request timeouts

Bill Moseley moseley at hank.org
Mon Aug 20 20:20:56 GMT 2012


On Mon, Aug 20, 2012 at 12:10 PM, Sergey Dmitriev <
sergey.programmer at gmail.com> wrote:

> Looks like what you need is the job queue. Take a look at
>
> Queue::DBI (https://metacpan.org/module/Queue::DBI) - simpler
> TheSchwartz (https://metacpan.org/module/TheSchwartz)
>

Yes, and what about long polling?  Would that solve the ajax request timing
out?  That is, have your client code get sent a message when the backend is
done instead of waiting.



>
> Sergey
>
> 2012/8/20 James R. Leu <jleu at mindspring.com>
>
>>  Hello all,
>>
>> Problem description
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> I have a catalyst application server that responds
>> to 'API' requests for web applications via XHTMLRequests.
>> Sometimes the requests are timing out due to the backend
>> database queries taking too long.  I'm looking for ways to
>> work around this and prevent the 'API' requests from
>> timing out.
>>
>> I know some of the possible resolutions to this are
>> - fix the queries
>> - fix the database
>> - frontend the RDBMS with NoSQL
>>
>> I'm working towards those fixes, but they are long
>> term projects, I'm looking for an interim solution.
>> That would notify the web application that it will
>> need to come back later for the response (ie decouple
>> request handling from the actual request/response).
>>
>> My attempt
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> In my handler I fork a child process.
>>
>> In the parent I send a response with a
>> 'job id' so the web application knows
>> to poll the 'API' for completion.
>>
>> In the child I close the IO socket so it cannot send
>> a response and then let it finish processing the
>> request, but it looks like I've lost my database
>> connections so the request fails.
>>
>> My wish
>> =3D=3D=3D=3D=3D=3D=3D
>> What I would like to do is avoid the fork and instead
>> have the handler send an early response to the
>> web application and then finish processing the request
>> and not try to send a response when done.
>>
>> Is there a common term for what I'm trying to do
>> like continuation or something like that?
>> Has anyone already done this?
>>
>> Thank you for your time.
>> --
>> James R. Leu
>> jleu at mindspring.com
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>>
>>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>


-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120820/4d422=
65b/attachment.htm


More information about the Catalyst mailing list