{"action":"created","issue":{"url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/436","labels_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/436/labels{/name}","comments_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/436/comments","events_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/436/events","html_url":"https://github.com/bitpay/bitcore-wallet-service/issues/436","id":126880193,"number":436,"title":"[Need suggestion]Wallet Balance retrieval is slow compared to bitpay.com","user":{"login":"dabura667","id":6586275,"avatar_url":"https://avatars.githubusercontent.com/u/6586275?v=3","gravatar_id":"","url":"https://api.github.com/users/dabura667","html_url":"https://github.com/dabura667","followers_url":"https://api.github.com/users/dabura667/followers","following_url":"https://api.github.com/users/dabura667/following{/other_user}","gists_url":"https://api.github.com/users/dabura667/gists{/gist_id}","starred_url":"https://api.github.com/users/dabura667/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabura667/subscriptions","organizations_url":"https://api.github.com/users/dabura667/orgs","repos_url":"https://api.github.com/users/dabura667/repos","events_url":"https://api.github.com/users/dabura667/events{/privacy}","received_events_url":"https://api.github.com/users/dabura667/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-15T14:13:43Z","updated_at":"2016-01-17T14:10:12Z","closed_at":null,"body":"I have an instance running bitcore with 0.11.2 bitcored full node and bws service running.\r\n\r\nMy VPS is:\r\n\r\n2 CPU\r\n4096 MB RAM\r\n1000 GB storage\r\n5000 GB transfer\r\n\r\ncurrently running with over 1 GB free RAM (even if you don't include cache) and CPU usage is low. Watching it on htop when I'm not running anything else and I register a new wallet (check all addresses) it only uses up 25% of my CPU. I have tested download and upload speeds and they are all fairly good.\r\n\r\nAlso, I and a few other people are the only people using it.\r\n\r\nHowever, when I do a wallet balance update for bws.bitpay.com it takes around 2 seconds. Whereas with my instance it takes more like 5-6 seconds.\r\n\r\nIf I do multiple requests in a row, they are both very fast (probably due to caching) but if I check the same wallet on two similar devices a day later. bitpay is 3-4 times faster consistently.\r\n\r\n\r\nI think maybe this has something to do with your server setup (ie using cloudflare etc. means more endpoints for routed packets to find as compared to me, where all my packets must get to a single server)\r\n\r\nCan anyone think of anything that might be bottlenecking me?\r\n\r\nI am going through a .com domain bought on namecheap with their default DNS, using SSL certs from letsencrypt. (maybe DNS has something to do with it?)"},"comment":{"url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/comments/172328484","html_url":"https://github.com/bitpay/bitcore-wallet-service/issues/436#issuecomment-172328484","issue_url":"https://api.github.com/repos/bitpay/bitcore-wallet-service/issues/436","id":172328484,"user":{"login":"dabura667","id":6586275,"avatar_url":"https://avatars.githubusercontent.com/u/6586275?v=3","gravatar_id":"","url":"https://api.github.com/users/dabura667","html_url":"https://github.com/dabura667","followers_url":"https://api.github.com/users/dabura667/followers","following_url":"https://api.github.com/users/dabura667/following{/other_user}","gists_url":"https://api.github.com/users/dabura667/gists{/gist_id}","starred_url":"https://api.github.com/users/dabura667/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabura667/subscriptions","organizations_url":"https://api.github.com/users/dabura667/orgs","repos_url":"https://api.github.com/users/dabura667/repos","events_url":"https://api.github.com/users/dabura667/events{/privacy}","received_events_url":"https://api.github.com/users/dabura667/received_events","type":"User","site_admin":false},"created_at":"2016-01-17T14:10:12Z","updated_at":"2016-01-17T14:10:12Z","body":"I just tested the new Copay, and for good measure I updated insight-api to latest npm in my node folder's dependencies folder.\r\n\r\nI did not see any real improvement.\r\n\r\nA suggestion: Can we just hold a simple boolean on BWS that is reset to false every time a user opens or closes (or switches) the app?\r\n\r\nBWS will only set this boolean to true if any transaction activity occurs. It will only set it to false by an API call from the app.\r\n\r\n99.999% of the time I open the app, it's because I am expecting a payment or getting ready to send a payment. And I rarely leave addresses out in public, so the chances of be receiving a transaction randomly are very low.\r\n\r\nI think if the problem is with my server's connection, the initial wallet update on app start would be faster if a preliminary call to get the boolean shot off and if the BWS boolean is still false, no need to hide the balance etc. anymore, as you know that nothing in the response from the server will change the balance. Making it faster to open the send screen and send some bitcoin.\r\n\r\nPerhaps the upcoming update to bitcore will help out some more. If someone could reply here when that update is ready, I'd appreciate it."}}