{"action":"created","issue":{"url":"https://api.github.com/repos/wbraynen/lighthouse-api/issues/3","labels_url":"https://api.github.com/repos/wbraynen/lighthouse-api/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/wbraynen/lighthouse-api/issues/3/comments","events_url":"https://api.github.com/repos/wbraynen/lighthouse-api/issues/3/events","html_url":"https://github.com/wbraynen/lighthouse-api/issues/3","id":115447846,"number":3,"title":"Add caching","user":{"login":"wbraynen","id":4765449,"avatar_url":"https://avatars.githubusercontent.com/u/4765449?v=3","gravatar_id":"","url":"https://api.github.com/users/wbraynen","html_url":"https://github.com/wbraynen","followers_url":"https://api.github.com/users/wbraynen/followers","following_url":"https://api.github.com/users/wbraynen/following{/other_user}","gists_url":"https://api.github.com/users/wbraynen/gists{/gist_id}","starred_url":"https://api.github.com/users/wbraynen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbraynen/subscriptions","organizations_url":"https://api.github.com/users/wbraynen/orgs","repos_url":"https://api.github.com/users/wbraynen/repos","events_url":"https://api.github.com/users/wbraynen/events{/privacy}","received_events_url":"https://api.github.com/users/wbraynen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-06T06:41:24Z","updated_at":"2015-11-12T20:34:15Z","closed_at":"2015-11-11T12:05:18Z","body":"Kinda [like this](https://codeforgeek.com/2015/07/using-redis-to-handle-session-in-node-js/), but maybe not a per-session basis.  Maybe just pre-cache all the endpoints' json results and the serve them from the cache instead of from disk."},"comment":{"url":"https://api.github.com/repos/wbraynen/lighthouse-api/issues/comments/156226086","html_url":"https://github.com/wbraynen/lighthouse-api/issues/3#issuecomment-156226086","issue_url":"https://api.github.com/repos/wbraynen/lighthouse-api/issues/3","id":156226086,"user":{"login":"wbraynen","id":4765449,"avatar_url":"https://avatars.githubusercontent.com/u/4765449?v=3","gravatar_id":"","url":"https://api.github.com/users/wbraynen","html_url":"https://github.com/wbraynen","followers_url":"https://api.github.com/users/wbraynen/followers","following_url":"https://api.github.com/users/wbraynen/following{/other_user}","gists_url":"https://api.github.com/users/wbraynen/gists{/gist_id}","starred_url":"https://api.github.com/users/wbraynen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbraynen/subscriptions","organizations_url":"https://api.github.com/users/wbraynen/orgs","repos_url":"https://api.github.com/users/wbraynen/repos","events_url":"https://api.github.com/users/wbraynen/events{/privacy}","received_events_url":"https://api.github.com/users/wbraynen/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T20:34:15Z","updated_at":"2015-11-12T20:34:15Z","body":"Ah cool!  ab lets you run concurrent tests.  So, I benchmarked it using `ab` (without concurrent runs, so it's the same kind of test as above) and this time taking a sample of 100 runs instead of 10, and the results are basically the same:\r\n\r\nFirstly, the improvement isn't as much as I expected: only 14% from, on average, 232ms to 198ms.\r\n\r\nBut more importantly:\r\n\r\nRedis with JSON.parse is slowest.\r\nRedis without JSON.parse is fastest.  (This is the redis branch.)\r\nWithout redis, so just with mongo, is in the middle.\r\n\r\nThe problem is that I need to call JSON.parse because otherwise I ended up with escaped double quotes.  And that means that with redis my API's performance actually suffers.  So, wondering if there is a better way to use redis or if, for some reason, redis just isn't suited to my use case (and if so, what's that reason?!).\r\n\r\n### Details and reproducibility\r\n\r\nThe ab command I ran:\r\n```\r\n$ ab -n 100 localhost:3000/nrc/datanotusedinrankings\r\n```\r\n\r\nThe numbers:\r\n```\r\n-------------------------\r\nREDIS WITH JSON.PARSE:\r\n\r\nConnection Times (ms)\r\n              min  mean[+/-sd] median   max\r\nConnect:        0    0   0.0      0       0\r\nProcessing:   243  278  25.5    273     358\r\nWaiting:      240  275  25.3    270     356\r\nTotal:        243  278  25.5    273     359\r\n\r\n-------------------------\r\nWITHOUT REDIS.  MONGODB ONLY:\r\n\r\n              min  mean[+/-sd] median   max\r\nConnect:        0    0   0.0      0       0\r\nProcessing:   200  232  24.3    229     338\r\nWaiting:      197  229  24.2    227     335\r\nTotal:        200  232  24.3    229     338\r\n\r\n-------------------------\r\nREDIS WITHOUT JSON.PARSE:\r\n\r\n              min  mean[+/-sd] median   max\r\nConnect:        0    0   0.0      0       0\r\nProcessing:   147  197  36.0    188     350\r\nWaiting:      144  195  35.9    186     347\r\nTotal:        147  198  36.0    189     350\r\n```\r\n"}}