Keep cool guys :)
Indeed, we are neither in a multi thread context nor in a single user
application, so it's not logic to add a "sleep()" call or similar.
APE is fully mono threaded and only works with async API (non blocking
socket, events API (epoll, kqueue), and so forth).
Therefore the JS API must be asynchronous as well.
You know flipkick, my little SQL request is typically performed in
less than 150 microseconds on my linux server. That means an active
wait would have frozen my whole APE server for something like the same
time. Huuuge !
Even if your SQL query is very fast, I can't agree. You can't trust your
MySQL server. What if you have to handle 1M entries? Imagine that your
query take 100ms, every users will be affected by this latencity.
It's definitly not the good way to write scalable applications ;-)
Anthony
Compare it to the typical time needed to execute most of your
javascript functions and you'll then understand that such time is just
nothing. Even compare it to the typical time slice of a linux
scheduler. Or compare it to the execution time of your asynchronous
solution, where you need to handle the one callback function and one
supplementary TCP connection because you sent the data in a second RAW.
You'll probably understand that in my case, an 'active wait' with a
while loop and a sleep(0) call - or event better, a yiel() call -
would have been more efficient than the asynchronous solution, even in
CPU load.
You were right one one point: I made too quickly the assumption that
the command's response had to be returned at the end of the command
callback function, that's why I was thinking about a synchronous solution.
In any case, the synchronous solution is not an option here, as the
APE JSF (likely mono-threaded) and the javascript language don't allow
it (at least for the moment). As my goal is simply to send the
response directly without the need of a second RAW, the solution
provided by Anthony is the best one so far.
It actually fits my needs, at least enough to let me stop wasting my
time on this part of my application.
For the rest let's keep reading books and blindly repeat what you have
readen, no matter if you don't think by yourself and/or try to adapt
you knowledge to the concrete context explained by the initiator of
the thread. It is well known that there is always only one solution to
a given problem as well as the world is only black and white, etc...
I'm convinced that flaming in discussion groups is the best way to
prove your 'profesionnal' attitude and skills, and surely will let you
make lot's of friends, all ready to provide you help the next time
you'll need some.
Best regards,
Nouk²
[end of discussion for me]
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/