Accessing await ctx.session() seems awkwardly slow #167
Unanswered
gregorkrambs
asked this question in
Q&A
Replies: 1 comment
-
Crypto can be slow. We'd need some profiling data to see if there is a bug somewhere. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was benchmarking my mojo.js app and found a huge bottleneck. I didn't expect calling
await ctx.session()
to slow down an application by factor 750x. To reproduce my observations, I freshly created an empty mojojs app and benchmarked it.
Running the default mojojs full app with
NODE_ENV=production node index.js server
: ~15,932 requests /secAfter adding
await ctx.session()
to the main route: ~21 requests /secI tested this with various setups (single threaded vs multi threaded, cluster mode and non-cluster mode, different machines: Mac OS X and Debian) but the huge difference between calling the session vs not calling the session was always huge.
While I expect the AES decryption to take some time, ~20 requests per second on a single thread (or ~600req/sec on a 64 core machine) for an empty app with just a session call is not very satisfying.
Am I doing something wrong here?
This can be reproduced by simply adding
const session = await ctx.session();
to thewelcome
route in theexample
controller ofnpm create @mojojs/full-app
.Beta Was this translation helpful? Give feedback.
All reactions