Replies: 1 comment 2 replies
-
|
Hi @D-i-t-gh - thanks for the message, this is a good question. Websockets are supposed to be really light weight, in fact the implementation itself should be much lighter than refreshing / polling. From my brief investigation, I think I know the reason for your slowdown though.... Just to clarity, you said "the client PC has a weak 2 core CPU" - I think you mean the server PC? Assuming this is correct (it's a weak server), you are likely expecting a bit too much from an old PC with 8 clients connected ~ while hammering it with messages :) It's also definitely not an "enterprise environment" either. But regardless, Mailpit is intended to be lightweight, and the slowdown issue you are experiencing is most likely due to Mailpit compressing every websocket message individually per client, rather than once for all clients. I have made a small chance which will compress once per message, not once per message per client, so you'll get 8x less compression happening. I suspect this should boost your performance considerably. The feature is currently only available in git (develop branch), and in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I've set up a benchmark script that sends 1000 messages over multiple worker threads to my Mailpit instance. I made the test while the Mailpit UI was opened in multiple browser windows. The benchmark script sent the messages to Mailpit over the local network, and at the same time the client PC's browser accessed Mailpit over the internet. The client PC has a weak 2 core CPU. These are the results:
Unfortunately this had a big impact on the server performance, which is not ideal especially in enterprise environments.
I made another test after I disabled the access to
/api/eventsin our reverse proxy. In the browser, I could see the messageUnable to connect to websocket, disabling websocket support. Now, the browser windows count doesn't have any impact on the server performance. However, there are no automatic UI updates any more.In issue #319 the author recommends to switch to a polling mode after Mailpit detects that there is no websocket support. I have another idea - implement a lightweight polling mechanism, e.g. every 15 seconds (or maybe some kind of smart stateful polling), that will compare the current message count on client and server, and if different show a red point somewhere near to the message count (and maybe also in the tab header) to notify the user. The user can then click on the refresh button to synchronize with the server.
With this notification we could deactivate websockets to make it less probable that clients slow down the performance, and also the users without websocket support would benefit. What do you think?
Beta Was this translation helpful? Give feedback.
All reactions