Generators
Pedro Lamarão
pedro.lamarao at prodist.com.br
Tue Nov 30 19:04:38 UTC 2021
Em qua., 24 de nov. de 2021 às 12:56, Ron Pressler <ron.pressler at oracle.com>
escreveu:
The thread could be any thread — platform or virtual. But yes, the
> construct would have to ensure that all calls are done on the same thread.
> Otherwise, we risk miscompilation (the JIT compiler works on the assumption
> that the current thread cannot change while executing a method; if it does,
> you might get strange results).
>
After a few experiments, I think this restriction is not difficult to
satisfy in a virtual threads architecture. If the application is
architected with thread-per-session, the parser instance is easily
thread-confined: the parser object may be created and bound to the
Runnable::run method stack, maybe even to a try-with-resources. If I
understood the restriction correctly, it is satisfied if the (Continuation
inside the) Generator is always activated in the same virtual thread. I
have put a few days into an HTTP parser and integrated it into a dumb HTTP
server architected like the above. Stress testing with Locust reached 20K
sessions in my work notebook (Intel Core i7 with 16GB RAM) and run
continually for about one hour without exploding.
--
Pedro Lamarão
https://www.prodist.com.br
Securing Critical Systems
Tel: +55 11 4380-6585
Antes de imprimir esta mensagem e seus anexos, certifique-se que seja
realmente necessário.
Proteger o meio ambiente é nosso dever.
Before printing this e-mail or attachments, be sure it is necessary.
It is in our hands to protect the environment.
More information about the loom-dev
mailing list