You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example implies that you can defer parts of the response and the server processes other requests in the meantime. This is how I understand asynchrony: To not wait for blocking calls but do useful stuff in the meantime.
A quick test shows that fapws3 blocks completely instead of handling the requests in parallel:
$ ab -n10 -c10 http://0.0.0.0:8080/
Concurrency Level: 10
Time taken for tests: 100.066 seconds
Complete requests: 10
Time per request: 100065.744 [ms] (mean)
10 concurrent requests took 100 seconds. That is an actual concurrency of exactly one :( The time.sleep() call blocks the entire server, which is no surprise if you look at it. sleep() (as any other blocking API) blocks the thread it is called in and fapws3 only utilises the main-thread. If an application blocks, the libev event-loop blocks too.
I think this should be documented. Fapws3 is asynchronous at network-side but totally synchronous at application-side. Ajax with long polling (for example) is not possible with fapws3.
By the way: This actually works with thread-based servers (until the worker thread-pool is exhausted that is).
The text was updated successfully, but these errors were encountered:
The iter-example basically looks like this:
The example implies that you can defer parts of the response and the server processes other requests in the meantime. This is how I understand asynchrony: To not wait for blocking calls but do useful stuff in the meantime.
A quick test shows that fapws3 blocks completely instead of handling the requests in parallel:
10 concurrent requests took 100 seconds. That is an actual concurrency of exactly one :( The
time.sleep()
call blocks the entire server, which is no surprise if you look at it.sleep()
(as any other blocking API) blocks the thread it is called in and fapws3 only utilises the main-thread. If an application blocks, the libev event-loop blocks too.I think this should be documented. Fapws3 is asynchronous at network-side but totally synchronous at application-side. Ajax with long polling (for example) is not possible with fapws3.
By the way: This actually works with thread-based servers (until the worker thread-pool is exhausted that is).
The text was updated successfully, but these errors were encountered: