{"action":"created","issue":{"url":"https://api.github.com/repos/piwik/piwik/issues/7104","labels_url":"https://api.github.com/repos/piwik/piwik/issues/7104/labels{/name}","comments_url":"https://api.github.com/repos/piwik/piwik/issues/7104/comments","events_url":"https://api.github.com/repos/piwik/piwik/issues/7104/events","html_url":"https://github.com/piwik/piwik/issues/7104","id":55918724,"number":7104,"title":"Up to 500% (and more) faster piwik GUI with a few lines...","user":{"login":"ThaDafinser","id":533017,"avatar_url":"https://avatars.githubusercontent.com/u/533017?v=3","gravatar_id":"","url":"https://api.github.com/users/ThaDafinser","html_url":"https://github.com/ThaDafinser","followers_url":"https://api.github.com/users/ThaDafinser/followers","following_url":"https://api.github.com/users/ThaDafinser/following{/other_user}","gists_url":"https://api.github.com/users/ThaDafinser/gists{/gist_id}","starred_url":"https://api.github.com/users/ThaDafinser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThaDafinser/subscriptions","organizations_url":"https://api.github.com/users/ThaDafinser/orgs","repos_url":"https://api.github.com/users/ThaDafinser/repos","events_url":"https://api.github.com/users/ThaDafinser/events{/privacy}","received_events_url":"https://api.github.com/users/ThaDafinser/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/piwik/piwik/labels/c:%20Performance","name":"c: Performance","color":"ededed"},{"url":"https://api.github.com/repos/piwik/piwik/labels/Enhancement","name":"Enhancement","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-01-29T16:07:50Z","updated_at":"2015-02-01T23:56:21Z","closed_at":null,"body":"tl;dr:\r\n\r\nChange https://github.com/piwik/piwik/blob/master/core/FrontController.php#L470 with this code (its an ugly hack to just show the gain)\r\n```php\r\nSession::start();\r\nif($module != 'CoreHome' && $module != 'Dashboard'){\r\n    Session::writeClose(true);\r\n}\r\n```\r\n\r\nSomehow i always felt that the GUI, especially the dashboard, is quiet slow.\r\n\r\nI now measured it and and remembered an easy solution when i comes to speed up AJAX requests.\r\nSince Piwik starts the session for each request, all pending requests are queued by php if i remember correctly https://github.com/piwik/piwik/blob/master/core/FrontController.php#L470\r\n(Reason: every request could write to the session and so it should be queued to have consistent session data)\r\n\r\nSo if you disable the ability to write session, the queueing is not needed anymore.\r\n\r\n***Note***\r\nThis is an ugly hack to just show the performance gain! Of course each action (or plugin) have to decide if it dont need to write anytime\r\n\r\n# without hack\r\n![current](https://cloud.githubusercontent.com/assets/533017/5960933/49a83e18-a7d9-11e4-9165-ba68892b51c7.jpg)\r\n\r\n# with hack\r\n![hack](https://cloud.githubusercontent.com/assets/533017/5960940/52a776fa-a7d9-11e4-956c-0c16a64eac91.jpg)\r\n\r\n.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/piwik/piwik/issues/comments/72392384","html_url":"https://github.com/piwik/piwik/issues/7104#issuecomment-72392384","issue_url":"https://api.github.com/repos/piwik/piwik/issues/7104","id":72392384,"user":{"login":"tsteur","id":273120,"avatar_url":"https://avatars.githubusercontent.com/u/273120?v=3","gravatar_id":"","url":"https://api.github.com/users/tsteur","html_url":"https://github.com/tsteur","followers_url":"https://api.github.com/users/tsteur/followers","following_url":"https://api.github.com/users/tsteur/following{/other_user}","gists_url":"https://api.github.com/users/tsteur/gists{/gist_id}","starred_url":"https://api.github.com/users/tsteur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsteur/subscriptions","organizations_url":"https://api.github.com/users/tsteur/orgs","repos_url":"https://api.github.com/users/tsteur/repos","events_url":"https://api.github.com/users/tsteur/events{/privacy}","received_events_url":"https://api.github.com/users/tsteur/received_events","type":"User","site_admin":false},"created_at":"2015-02-01T23:56:21Z","updated_at":"2015-02-01T23:56:21Z","body":"I did another test on a production system. I reloaded the pages many times to make sure it is not a random result because of something else.\r\n\r\nWithout session close (load event after 8.8s):\r\n\r\n![without_session_close](https://cloud.githubusercontent.com/assets/273120/5994478/1e4926ac-aada-11e4-83a5-56df07f00f94.png)\r\n\r\nWith session close (load event after 7.8s):\r\n\r\n![with_session_close](https://cloud.githubusercontent.com/assets/273120/5994479/26fec8ce-aada-11e4-91d0-064cb18652e9.png)\r\n\r\nAs one can see most reports load faster especially the ones further below (they have to wait longer). Some requests take only 1 second instead of 3. For some other the benefit is not as big (because they didn't have to wait that long of course). One was actually able to see that reports were loading a bit faster and more in \"parallel\""}}