3 ms·
But you are using nice chunky grained blocks of asynchronous-ity (which makes it easier) rather than spreading it evenly throughout your program (often quite ha
by gridspy 17y ago
But you are using nice chunky grained blocks of asynchronous-ity (which makes it easier) rather than spreading it evenly throughout your program (often quite hard).
- aaronblohowiak 17y agoIt Depends. I wasn't trying to lobby for or against different granularities of asynchrony or where you chose to branch the execution path, but was merely trying to point out that asynchrony is still involved. One of the more confusing things that I've experienced recently is that some programmers get a little fuzzy when you ask if an HTTP request is synchronous. That is, is the body of an HTTP response considered synchronous communication with the client. In my view of the system, HTTP (sans keep-alive) supports a single synchronous message and response, whereas some people try to assert that the response happens after the completion of the request is sent, so the communication is actually asynchronous. From that point of view, I can see how the terminology is vague. However, if we are talking about program control flow and say that blocking on a function call is synchronous and various other forms of deferred evaluation are asynchronous, then the HTTP lifecycle starts to fit the "synchronous" model more closely (note that I'm not talking about http client libraries here.) Anyway, this does lead into one of my favorite interview questions: "Is JavaScript multithreaded?" Many people get hung up on AJAX and setTimeout... but these are the same people that don't really get the tech at a fundamental level.
- gridspy 17y agoOn an initial page load, the user tends to be blocking on the page response - the user is forced to treat it as a synchronous operation, though they can task switch to other pages. On the server side, the merit of asynchronous processing depends on the goal. I'm quite happy to spin up multiple processes and have each process synchronous process a single request on the server - my time is too valuable to debug the alternatives at the moment. I'm quite happy to admit that my HTTP requests are processed synchronously by Apache, mod_python and django. Even the out-of-band requests from ajax also tend to be synchronously processed. On my power dashboard, I handle ongoing comms using Twisted and totally asynchronously - pushing data to the user through Orbited. This gives our system an extremely fast response rate. Event loop driven code is the key to decent firmware performance. It is how we ensured that the responsiveness our our hardware solutions in the past (such as the Kiddie Kart) was very good.