{"action":"created","issue":{"url":"https://api.github.com/repos/Netflix/vector/issues/21","labels_url":"https://api.github.com/repos/Netflix/vector/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/vector/issues/21/comments","events_url":"https://api.github.com/repos/Netflix/vector/issues/21/events","html_url":"https://github.com/Netflix/vector/issues/21","id":67467080,"number":21,"title":"Too many /_indom requests when chart has many time-series/instances","user":{"login":"meteorfox","id":232300,"avatar_url":"https://avatars.githubusercontent.com/u/232300?v=3","gravatar_id":"","url":"https://api.github.com/users/meteorfox","html_url":"https://github.com/meteorfox","followers_url":"https://api.github.com/users/meteorfox/followers","following_url":"https://api.github.com/users/meteorfox/following{/other_user}","gists_url":"https://api.github.com/users/meteorfox/gists{/gist_id}","starred_url":"https://api.github.com/users/meteorfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meteorfox/subscriptions","organizations_url":"https://api.github.com/users/meteorfox/orgs","repos_url":"https://api.github.com/users/meteorfox/repos","events_url":"https://api.github.com/users/meteorfox/events{/privacy}","received_events_url":"https://api.github.com/users/meteorfox/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Netflix/vector/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"spiermar","id":2207415,"avatar_url":"https://avatars.githubusercontent.com/u/2207415?v=3","gravatar_id":"","url":"https://api.github.com/users/spiermar","html_url":"https://github.com/spiermar","followers_url":"https://api.github.com/users/spiermar/followers","following_url":"https://api.github.com/users/spiermar/following{/other_user}","gists_url":"https://api.github.com/users/spiermar/gists{/gist_id}","starred_url":"https://api.github.com/users/spiermar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spiermar/subscriptions","organizations_url":"https://api.github.com/users/spiermar/orgs","repos_url":"https://api.github.com/users/spiermar/repos","events_url":"https://api.github.com/users/spiermar/events{/privacy}","received_events_url":"https://api.github.com/users/spiermar/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Netflix/vector/milestones/1","html_url":"https://github.com/Netflix/vector/milestones/r1.0.1","labels_url":"https://api.github.com/repos/Netflix/vector/milestones/1/labels","id":1063563,"number":1,"title":"r1.0.1","description":"","creator":{"login":"spiermar","id":2207415,"avatar_url":"https://avatars.githubusercontent.com/u/2207415?v=3","gravatar_id":"","url":"https://api.github.com/users/spiermar","html_url":"https://github.com/spiermar","followers_url":"https://api.github.com/users/spiermar/followers","following_url":"https://api.github.com/users/spiermar/following{/other_user}","gists_url":"https://api.github.com/users/spiermar/gists{/gist_id}","starred_url":"https://api.github.com/users/spiermar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spiermar/subscriptions","organizations_url":"https://api.github.com/users/spiermar/orgs","repos_url":"https://api.github.com/users/spiermar/repos","events_url":"https://api.github.com/users/spiermar/events{/privacy}","received_events_url":"https://api.github.com/users/spiermar/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2015-04-12T06:51:54Z","updated_at":"2015-04-12T07:00:28Z","due_on":"2015-04-17T07:00:00Z","closed_at":null},"comments":6,"created_at":"2015-04-09T22:49:43Z","updated_at":"2015-04-13T18:03:54Z","closed_at":null,"body":"When loading a widget that pulls multiple time-series (i.e. Per-CPU utilization, Network Throughput), for each time-series an HTTP request is sent with this format:\r\n\r\n`http://<host>:44323/pmapi/<context>/_indom?name=<metric>&instance=<instance_num>`\r\n\r\nThis slows down significantly the browser, and the widgets remain with 'No available data' for long times. \r\n\r\nFor example, one of my hosts has 12 CPUs, the CPU utilization fires 24 HTTP requests to gather the name of the time-series/instance, 12 times for `kernel.percpu.cpu.sys`, and 12 times for `kernel.percpu.cpu.user`.\r\n\r\nHere's a screenshot of network tab in Chrome:\r\n![screenshot from 2015-04-09 17 33 02](https://cloud.githubusercontent.com/assets/232300/7078453/cc620870-dede-11e4-9bc8-26951ff3a866.png)\r\n\r\n\r\nFor Network throughput is even worse, since pmwebd is slow retrieving network data and I have 25 network interfaces (bridges, bonds, and interfaces), I can't even load the chart, unless I wait minutes for it.\r\n\r\nThe culprit seems to be how `Metric.pushValues()` and `MetricService.getInames()` functions are designed, and how they are called by `MetricListService.updateMetrics()`, instead of getting all Inames in one batch, it retrieves them one by one.\r\n\r\nIt seems that pmwebd supports retrieving all the instances name in one batch by doing just dropping the `instance` query parameter like so:\r\n\r\n`GET http://<host>:44323/pmapi/<context>/_indom?name=kernel.percpu.cpu.user`\r\n\r\nwith returned the following response:\r\n\r\n```json\r\n{\r\n    \"indom\":251658240,\r\n    \"instances\":[\r\n        { \"instance\":0, \"name\":\"cpu0\" },\r\n        { \"instance\":1, \"name\":\"cpu1\" },\r\n        { \"instance\":2, \"name\":\"cpu2\" },\r\n        { \"instance\":3,  \"name\":\"cpu3\" },\r\n        { \"instance\":4,  \"name\":\"cpu4\" },\r\n        { \"instance\":5,  \"name\":\"cpu5\" },\r\n        { \"instance\":6,  \"name\":\"cpu6\" },\r\n        { \"instance\":7,  \"name\":\"cpu7\" },\r\n        { \"instance\":8,  \"name\":\"cpu8\" },\r\n        { \"instance\":9,  \"name\":\"cpu9\" },\r\n        { \"instance\":10,  \"name\":\"cpu10\" },\r\n        { \"instance\":11,  \"name\":\"cpu11\" }\r\n    ]\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/Netflix/vector/issues/comments/92447282","html_url":"https://github.com/Netflix/vector/issues/21#issuecomment-92447282","issue_url":"https://api.github.com/repos/Netflix/vector/issues/21","id":92447282,"user":{"login":"spiermar","id":2207415,"avatar_url":"https://avatars.githubusercontent.com/u/2207415?v=3","gravatar_id":"","url":"https://api.github.com/users/spiermar","html_url":"https://github.com/spiermar","followers_url":"https://api.github.com/users/spiermar/followers","following_url":"https://api.github.com/users/spiermar/following{/other_user}","gists_url":"https://api.github.com/users/spiermar/gists{/gist_id}","starred_url":"https://api.github.com/users/spiermar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spiermar/subscriptions","organizations_url":"https://api.github.com/users/spiermar/orgs","repos_url":"https://api.github.com/users/spiermar/repos","events_url":"https://api.github.com/users/spiermar/events{/privacy}","received_events_url":"https://api.github.com/users/spiermar/received_events","type":"User","site_admin":false},"created_at":"2015-04-13T18:03:54Z","updated_at":"2015-04-13T18:03:54Z","body":"Something wrong with the _indom requests. Debugging later today."}}