Thanks for the explanation Massimo. I figured it must be an issue with
python's architecture or something would have been added to the std
lib by now.

It's easy enough to simulate this behavior with ajax calls to
controllers from the client. Unfortunately since you can't rely on
javascript being enabled, it can't be used in every situation. Sort of
peculiar how a browser on the client's computer is more capable in
this area than a powerful web server.

It would be neat if someone set up a publish/subscribe api that could
act as an async proxy for synchronous servers. You would make a
request that included a target url and a callback url. Maybe something
like this already exists?


On Feb 18, 11:31 pm, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> It is more complex than this. It is about two different models to
> handle concurrency.
>
> In one model you have one thread per request. Each request does IO
> with the client within one thread. The web server creates and manages
> the threads connects the thread to the web app (for example web2py)
> via mod_wsgi.
>
> In another model you do not have threads. You have async IO. It allows
> to serve more clients at the same time if the requests are really
> simple. If the computation is significative you may have concurrency
> issues.
>
> Then you can heve async io with ligthweight thread within is the best
> of both worlds.
>
> Python does not have built-in lightweight threads. web2py is based on
> mod_wsgi which does not support async.
>
> Anyway, this is not a definitive word on the subject.
>
> Massimo
>
> On Feb 18, 9:15 pm, Dane <dane.schnei...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Synchronous http makes the call and stops further execution until the
> > result is returned.
>
> > Async makes the call and optionally provides a callback so that
> > further code can be executed while waiting for the response. The way
> > ajax calls with in javascript, for example.
>
> > Seems like basic functionality--strange that something so useful isn't
> > built in to python in a straightforward way. It would be great if
> > web2py could do something to address this. There are many use cases
> > and it's much easier and lighter weight than dealing with threads,
> > processes, cron, etc. when all that is needed is a quick non-blocking
> > call.
>
> > On Feb 18, 8:52 am, KMax <mkostri...@gmail.com> wrote:
>
> > > asynchronous http and synchronous http
> > > What the difference ?
> > > On 18 фев, 10:37, Dane <dane.schnei...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I need to make an asynchronous http request to one of my controller
> > > > functions in order to some lightweight background processing
> > > > (refreshing some cached objects). I came upon this thread:
>
> > > >http://groups.google.com/group/web2py/browse_thread/thread/bbe66f1084...
>
> > > > But the link to the "lola" function posted post by Massimo is broken.
> > > > Can anyone supply a new link or explain a simple way to make async,
> > > > ajax-like requests from within web2py? Thanks.
>
> > > > -Dane

Reply via email to