matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.71k stars 2.62k forks source link

Making the felt & objective speed of piwik faster #4333

Open hpvd opened 10 years ago

hpvd commented 10 years ago

Making the felt & objective speed of piwik sites faster via using big pipe concept:

BigPipe allows speeding up page rendering times by loading the page in small parts called pagelets. This allows browser to start rendering the page while the php server is still processing to finish the rest. This transforms the traditional page rendering cycle into following steps:

1) Browser requests the page from server 2) Server quickly renders a page skeleton containing the <head> tags and a body with empty div elements which act as containers to the pagelets. The HTTP connection to the browser stays open as the page is not yet finished. 3) Browser will start downloading the bigpipe.js file and after that it'll start rendering the page 4) The PHP server process is still executing and its building each pagelet at a time. Once a pagelet has been completed it's results are sent to the browser inside a <script>BigPipe.onArrive(...)</script> tag. 5) Browser injects the html code received into the correct place. If the pagelet needs any CSS resources those are also downloaded. 6) After all pagelets have been received the browser starts to load all external javascript files needed by those pagelets. 7) After javascripts are downloaded browser executes all inline javascripts.

informations and an implementation for php sites e.g. https://github.com/garo/bigpipe

another example is the implementation for magento: https://github.com/sitewards/BigPipe

mattab commented 10 years ago

Thanks for the suggestion! but because Piwik is already built piece by piece using ajax, I think it's not really required to do this.. it wouldn't make it much faster as if Piwik was generating all content as one page.

hpvd commented 10 years ago

There was an great article about this topic in the latest t3n Paper magazine. contents: http://t3n.de/magazin/t3n-nr-34-die-100-wichtigsten-koepfe-im-netz/

They show some (unspecific) comparisons of pages

if you are a FB user: these links were provided to see the difference on facebook: with big pipe: http://t3n.me/15ZNr8K without big pipe: http://t3n.me/1bYDBZd