{"action":"created","issue":{"url":"https://api.github.com/repos/openwrt/luci/issues/459","repository_url":"https://api.github.com/repos/openwrt/luci","labels_url":"https://api.github.com/repos/openwrt/luci/issues/459/labels{/name}","comments_url":"https://api.github.com/repos/openwrt/luci/issues/459/comments","events_url":"https://api.github.com/repos/openwrt/luci/issues/459/events","html_url":"https://github.com/openwrt/luci/issues/459","id":104043735,"node_id":"MDU6SXNzdWUxMDQwNDM3MzU=","number":459,"title":"Luci front page auto-refresh is CPU heavy for the router","user":{"login":"hnyman","id":7926856,"node_id":"MDQ6VXNlcjc5MjY4NTY=","avatar_url":"https://avatars3.githubusercontent.com/u/7926856?v=4","gravatar_id":"","url":"https://api.github.com/users/hnyman","html_url":"https://github.com/hnyman","followers_url":"https://api.github.com/users/hnyman/followers","following_url":"https://api.github.com/users/hnyman/following{/other_user}","gists_url":"https://api.github.com/users/hnyman/gists{/gist_id}","starred_url":"https://api.github.com/users/hnyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hnyman/subscriptions","organizations_url":"https://api.github.com/users/hnyman/orgs","repos_url":"https://api.github.com/users/hnyman/repos","events_url":"https://api.github.com/users/hnyman/events{/privacy}","received_events_url":"https://api.github.com/users/hnyman/received_events","type":"User","site_admin":false},"labels":[{"id":136257315,"node_id":"MDU6TGFiZWwxMzYyNTczMTU=","url":"https://api.github.com/repos/openwrt/luci/labels/help%20wanted","name":"help wanted","color":"fef2c0","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2015-08-31T12:21:09Z","updated_at":"2018-06-25T09:56:00Z","closed_at":"2018-06-25T09:56:00Z","author_association":"CONTRIBUTOR","body":"I have felt some sluggishness on the front page every now and then. I have also noticed some forum discussion on \"slow Luci\" ( https://forum.openwrt.org/viewtopic.php?id=59113 ).\n\nI have also noticed that if the front page is left open on the browser with the default setting \"auto refresh on\", the CPU load in statistics grows surprisingly high. Even in my rather powerful WNDR3700, the CPU load goes over 20% just by having that front page open in browser...\n\nBelow is a graph highlighting this, tested with both Firefox and IE.\n- Router is otherwise practically idle when I open the Luci front page and leave that page open. CPU load shoots to 20-25%, while the page updated dynamic content every 5 secs. \n- When moving to another page, the load immediately stops. \n- My front page has three XHR sections: main, DDND and UPNP. So I further tested uninstalling the Luci DDNS and MiniUPNP components, as their data is updated dynamically too. That cut the CPU load into half. So, the main Luci front page already causes rather high load by itself, but having three auto-refreshing sections really kills the CPU.\n\n![cpuloadgraph](https://cloud.githubusercontent.com/assets/7926856/9578347/a9ebce3c-4ff1-11e5-9a0a-98838b77eea8.png)\n\nWhen profiling the front page with browser tools, the updating looks heavy. \n- When all three components are enabled, even the main data update takes almost 1.2 seconds (every 5 seconds). And there are 2 requests per cycle, main, DDNS and UPNP.\n  ![frontpagecapture](https://cloud.githubusercontent.com/assets/7926856/9578401/5c9a4220-4ff2-11e5-95ed-741e3d2deddb.PNG)\n- If DDNS and UPNP components are disabled, the update duration decreases to 0.5s. So, having three updating components, slows things downs significantly\n  ![frontpagelow_no_ddns_upnp](https://cloud.githubusercontent.com/assets/7926856/9578402/5e367dba-4ff2-11e5-8f08-356c8c10fe3d.PNG)\n\nI have not yet tried to debug which section is the culprit, or if there is something too iterative in the lua script.\n\nJow, \nwould it be ok to decrease the XHR update frequency from 5 secs to 10 secs?\nOr any ideas about further debugging?\n\nEDIT:\nIncreasing update frequency to 15s naturally cuts the CPU utilization to a third, just as expected:\n![cpuload2graph](https://cloud.githubusercontent.com/assets/7926856/9578739/3257e1ae-4ff5-11e5-8f11-ea48708422a5.png)\n"},"comment":{"url":"https://api.github.com/repos/openwrt/luci/issues/comments/399897640","html_url":"https://github.com/openwrt/luci/issues/459#issuecomment-399897640","issue_url":"https://api.github.com/repos/openwrt/luci/issues/459","id":399897640,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTg5NzY0MA==","user":{"login":"jow-","id":2528802,"node_id":"MDQ6VXNlcjI1Mjg4MDI=","avatar_url":"https://avatars2.githubusercontent.com/u/2528802?v=4","gravatar_id":"","url":"https://api.github.com/users/jow-","html_url":"https://github.com/jow-","followers_url":"https://api.github.com/users/jow-/followers","following_url":"https://api.github.com/users/jow-/following{/other_user}","gists_url":"https://api.github.com/users/jow-/gists{/gist_id}","starred_url":"https://api.github.com/users/jow-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jow-/subscriptions","organizations_url":"https://api.github.com/users/jow-/orgs","repos_url":"https://api.github.com/users/jow-/repos","events_url":"https://api.github.com/users/jow-/events{/privacy}","received_events_url":"https://api.github.com/users/jow-/received_events","type":"User","site_admin":false},"created_at":"2018-06-25T09:56:00Z","updated_at":"2018-06-25T09:56:00Z","author_association":"CONTRIBUTOR","body":"This was likely caused by inefficient status page plugins."}}
{"actor":{"display_login":"jow-"}}