I was doing tons of efforts to optimize my website, and while checking the performance reports, for tons of pages (including the home page). I could find that it gives these two “poll” requests that are taking too long to load, Is it a Poll plugin being loaded though non of those pages have the poll plugin in them being used and the user loading is anonymous.
nop, not unique setup at all…
and it’s not slowing down the website that much, but it’s being the slowest for sure. and made me wonder how really important it is. and whether or not can sacrifice it.
You’ve said it takes 30 seconds everytime, though those stats are from pingdome, and it’s just a single call the full time to load everything is around 300ms at the moment. and poll is being called twice at least during that time (or at a single call to the page).
Since as mentioned it’s being called Twice on the initial page load, wouldn’t it make more sense to load fresh page (with all notifications, topics…Etc) on the first call. and then wait 30s before making another call to it?!
Or at least if it’s limited by the structure on wish discourse has been programmed on (which I believe it doesn’t), then a single poll call would just do.
The initial page load is typically the most expensive (exception maybe being an image heavy topic) because essentially the entire app is getting loaded. After that it’s the “live update” stuff.
Subsequent pages do not load in the entire app again.
It’s “from server side” insofar as the server controls the fact that all requests are all going to the same domain, however it’s the browser that decides to make no more than N connections to the server in parallel. Since that’s never going to get fixed, just switch to using HTTP/2 (it should be built-in, as long as you’re using TLS) and everything will be much, much better.
MessageBus is responsible for pushing live notifications from the server to the clients.
So, for example, as soon as someone 's this message I get a blue notification on the top right. Or if someone replies this page will refresh right away with the reply.
MessageBus using long polling with chunked encoding, what this means is that a single 30 second session can push multiple messages from the server to the client.
The 30 second requests here are not a performance concern, payloads are tiny and the server is designed to handle this traffic very easily. Since you are using H2 it does not even eat up a connection slot like it would in the old days of H1. Once browser moves to a background tab message bus is smart enough to slow down its polling.