{"action":"created","issue":{"url":"https://api.github.com/repos/codeforseattle/seanetmap/issues/21","labels_url":"https://api.github.com/repos/codeforseattle/seanetmap/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/codeforseattle/seanetmap/issues/21/comments","events_url":"https://api.github.com/repos/codeforseattle/seanetmap/issues/21/events","html_url":"https://github.com/codeforseattle/seanetmap/issues/21","id":73465339,"number":21,"title":"NDT-JS: post test (should be idle) it can be a CPU hog. New code fixes it.","user":{"login":"JohnTigue","id":473077,"avatar_url":"https://avatars.githubusercontent.com/u/473077?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnTigue","html_url":"https://github.com/JohnTigue","followers_url":"https://api.github.com/users/JohnTigue/followers","following_url":"https://api.github.com/users/JohnTigue/following{/other_user}","gists_url":"https://api.github.com/users/JohnTigue/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnTigue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnTigue/subscriptions","organizations_url":"https://api.github.com/users/JohnTigue/orgs","repos_url":"https://api.github.com/users/JohnTigue/repos","events_url":"https://api.github.com/users/JohnTigue/events{/privacy}","received_events_url":"https://api.github.com/users/JohnTigue/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/codeforseattle/seanetmap/labels/1%20-%20Ready","name":"1 - Ready","color":"CCCCCC"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-05T23:47:50Z","updated_at":"2015-05-26T16:24:54Z","closed_at":null,"body":"See also #11 as that may be the same code being discussed there.\r\n\r\nThe following is an email thread between @JohnTigue and @collina on 2015-05-05:\r\n\r\n---\r\nOn 05/01/2015 03:03 PM, John Tigue wrote:\r\nChris and Will,\r\n\r\nOn May 1, 2015, at 6:15 AM, Chris Ritzo <critzo@opentechinstitute.org> wrote:\r\n\r\n- M-Lab developers will update the javascript client code to point at\r\nour production servers, and integrate some new functions that enable\r\nbroader choices in frontend support.\r\n\r\nChirs: Please tell me about this new functionality?\r\n\r\nI'll have to defer to Nathan and Collin on this (cc'd).\r\n\r\nI think Collin ran into some performance issues with D3.js in another\r\nproject he was working on, but this will only be an issue for your\r\nproject if you want to stay updated with the current code in our repo.\r\n\r\n---\r\nHello Nathan and Collin,\r\n\r\nI am one of the folks working as part of Code for Seattle in order to get a M-Lab clienting portal going for the city of Seattle.\r\n\r\nI am writing because of the performance issues that Chris mentioned above. I too have seen something. Perhaps it is the same.\r\n\r\nI can repo the test via the ndt-javascript-client as found at:\r\n\r\nhttp://files.opentechinstitute.org/~critzo/mlab/examples/ndt-javascript-client/examples/d3_circle/\r\n\r\nIf I simply load that page and wait for things to settle down, my CPU usage drops quickly to idle. If I then I run the test, the CPU meter immediately goes to about 50% (that's OK; it's working hard). After a few second the NDT test ends but the CPU stays the same, about 50%. This is a 2011 MacBook Air I am testing on.\r\n\r\nI was going to dig into and report via GitHub but Chris' comments made me think that perhaps you are already on it.\r\n\r\nLet me know if I can help with test, or I can get down to trying to debug it as well if this is not actually the same performance issue that Chris mentioned.\r\n-John\r\n\r\n---\r\nNice catch. \r\n\r\nThe D3 progress meter was designed when there was no onprogress callback for NDTjs, and without performance in mind. As a result, it's updated based on the d3.timer function with an interval of 0, which means that it's constantly triggering and consequently takes a large amount of resources.\r\n\r\nThe alternative that we are transitioning to is using the onprogress callback, which also has the benefit of passing the current test performance information, and then using a Javascript progress meter. We determine the progress through retaining the timestamp that the test changed state (to 'running_s2c' or 'running_c2s'). In this case, we set the call back to trigger every few hundred milliseconds, and then increment the progress meter based on the amount of lapsed since the state changed.\r\n\r\nSince NDT runs for 10 secs, so progress = (currentTime - timeStateChanged)/10. \r\n\r\nAs a result, you won't be redrawing D3 at every moment of the test. \r\n\r\nDoes that make sense?\r\n\r\nCordially,\r\nCollin\r\n\r\n---\r\nYup, got it.\r\n \r\nThere's no way that our site is going to be going public in the next week or so.\r\n\r\nI'll put this on hold and wait for the new onprogress callback mechanism.\r\n\r\nI've got tons of status===\"does not exist\" keeping me busy before I need to worry about CPU piggies in the client. \r\n\r\nThanks,\r\n-John\r\n---\r\nIt exists currently, we are now developing out in the official NDT repository, so you can grab it here: https://github.com/ndt-project/ndt/blob/master/HTML5-frontend/ndt-browser-client.js\r\n\r\n<!---\r\n@huboard:{\"order\":7.0,\"milestone_order\":21,\"custom_state\":\"\"}\n-->\r\n"},"comment":{"url":"https://api.github.com/repos/codeforseattle/seanetmap/issues/comments/105589581","html_url":"https://github.com/codeforseattle/seanetmap/issues/21#issuecomment-105589581","issue_url":"https://api.github.com/repos/codeforseattle/seanetmap/issues/21","id":105589581,"user":{"login":"JohnTigue","id":473077,"avatar_url":"https://avatars.githubusercontent.com/u/473077?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnTigue","html_url":"https://github.com/JohnTigue","followers_url":"https://api.github.com/users/JohnTigue/followers","following_url":"https://api.github.com/users/JohnTigue/following{/other_user}","gists_url":"https://api.github.com/users/JohnTigue/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnTigue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnTigue/subscriptions","organizations_url":"https://api.github.com/users/JohnTigue/orgs","repos_url":"https://api.github.com/users/JohnTigue/repos","events_url":"https://api.github.com/users/JohnTigue/events{/privacy}","received_events_url":"https://api.github.com/users/JohnTigue/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T16:24:53Z","updated_at":"2015-05-26T16:24:53Z","body":"I think it is time to start bringing in client side dependencies via bower. The project needs to level-up to a more mature process of this front. Currently the code, say for NDT-JS, is just copied manually into the repo. We should really be pulling it in as a dependency, not a code inside SEANetMap's repo.\r\n\r\nSame goes for server deps. We have bq2geojson in the codebase:  \r\nhttps://github.com/codeforseattle/seanetmap/tree/master/server/bq2geojson\r\n\r\nThat too should be pulled in (via npm, not bower)"}}