{"action":"created","issue":{"url":"https://api.github.com/repos/dgraph-io/dgraph/issues/1938","repository_url":"https://api.github.com/repos/dgraph-io/dgraph","labels_url":"https://api.github.com/repos/dgraph-io/dgraph/issues/1938/labels{/name}","comments_url":"https://api.github.com/repos/dgraph-io/dgraph/issues/1938/comments","events_url":"https://api.github.com/repos/dgraph-io/dgraph/issues/1938/events","html_url":"https://github.com/dgraph-io/dgraph/issues/1938","id":283239555,"number":1938,"title":"High CPU usage in dgraph v1.0.0 when I don't do any queries/mutations","user":{"login":"sgon00","id":1555508,"avatar_url":"https://avatars2.githubusercontent.com/u/1555508?v=4","gravatar_id":"","url":"https://api.github.com/users/sgon00","html_url":"https://github.com/sgon00","followers_url":"https://api.github.com/users/sgon00/followers","following_url":"https://api.github.com/users/sgon00/following{/other_user}","gists_url":"https://api.github.com/users/sgon00/gists{/gist_id}","starred_url":"https://api.github.com/users/sgon00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgon00/subscriptions","organizations_url":"https://api.github.com/users/sgon00/orgs","repos_url":"https://api.github.com/users/sgon00/repos","events_url":"https://api.github.com/users/sgon00/events{/privacy}","received_events_url":"https://api.github.com/users/sgon00/received_events","type":"User","site_admin":false},"labels":[{"id":633145183,"url":"https://api.github.com/repos/dgraph-io/dgraph/labels/investigate","name":"investigate","color":"e99695","default":false}],"state":"open","locked":false,"assignee":{"login":"janardhan1993","id":815780,"avatar_url":"https://avatars3.githubusercontent.com/u/815780?v=4","gravatar_id":"","url":"https://api.github.com/users/janardhan1993","html_url":"https://github.com/janardhan1993","followers_url":"https://api.github.com/users/janardhan1993/followers","following_url":"https://api.github.com/users/janardhan1993/following{/other_user}","gists_url":"https://api.github.com/users/janardhan1993/gists{/gist_id}","starred_url":"https://api.github.com/users/janardhan1993/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janardhan1993/subscriptions","organizations_url":"https://api.github.com/users/janardhan1993/orgs","repos_url":"https://api.github.com/users/janardhan1993/repos","events_url":"https://api.github.com/users/janardhan1993/events{/privacy}","received_events_url":"https://api.github.com/users/janardhan1993/received_events","type":"User","site_admin":false},"assignees":[{"login":"janardhan1993","id":815780,"avatar_url":"https://avatars3.githubusercontent.com/u/815780?v=4","gravatar_id":"","url":"https://api.github.com/users/janardhan1993","html_url":"https://github.com/janardhan1993","followers_url":"https://api.github.com/users/janardhan1993/followers","following_url":"https://api.github.com/users/janardhan1993/following{/other_user}","gists_url":"https://api.github.com/users/janardhan1993/gists{/gist_id}","starred_url":"https://api.github.com/users/janardhan1993/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janardhan1993/subscriptions","organizations_url":"https://api.github.com/users/janardhan1993/orgs","repos_url":"https://api.github.com/users/janardhan1993/repos","events_url":"https://api.github.com/users/janardhan1993/events{/privacy}","received_events_url":"https://api.github.com/users/janardhan1993/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/dgraph-io/dgraph/milestones/19","html_url":"https://github.com/dgraph-io/dgraph/milestone/19","labels_url":"https://api.github.com/repos/dgraph-io/dgraph/milestones/19/labels","id":2889092,"number":19,"title":"v1.x","description":"","creator":{"login":"manishrjain","id":1782324,"avatar_url":"https://avatars1.githubusercontent.com/u/1782324?v=4","gravatar_id":"","url":"https://api.github.com/users/manishrjain","html_url":"https://github.com/manishrjain","followers_url":"https://api.github.com/users/manishrjain/followers","following_url":"https://api.github.com/users/manishrjain/following{/other_user}","gists_url":"https://api.github.com/users/manishrjain/gists{/gist_id}","starred_url":"https://api.github.com/users/manishrjain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manishrjain/subscriptions","organizations_url":"https://api.github.com/users/manishrjain/orgs","repos_url":"https://api.github.com/users/manishrjain/repos","events_url":"https://api.github.com/users/manishrjain/events{/privacy}","received_events_url":"https://api.github.com/users/manishrjain/received_events","type":"User","site_admin":false},"open_issues":62,"closed_issues":30,"state":"open","created_at":"2017-11-06T01:26:15Z","updated_at":"2018-02-05T03:02:08Z","due_on":null,"closed_at":null},"comments":22,"created_at":"2017-12-19T14:02:51Z","updated_at":"2018-02-05T15:12:48Z","closed_at":null,"author_association":"NONE","body":"**Dgraph version:**\r\n\r\n```\r\nDgraph version   : v1.0.0\r\nCommit SHA-1     : 7a64f54b\r\nCommit timestamp : 2017-12-18 15:04:40 +0530\r\nBranch           : HEAD\r\n```\r\n\r\n**Dgraph linux binary:** `dgraph-linux-amd64-v1.0.0.tar.gz`\r\n\r\n**OS:** `Manjaro` (Based on `Arch Linux`. I consider it's the same as arch linux)\r\n\r\n**How do I run dgraph:**\r\n\r\n```\r\ndgraph zero --port_offset -2000 -w ${db_path}/zw/ >> ${log_file_zero} 2>&1 &\r\nsleep 10\r\ndgraph server --memory_mb 1024 --zero localhost:5080 -p ${db_path}/p/  -w ${db_path}/w/ >> ${log_file_server} 2>&1 &\r\n```\r\n\r\n1. Create the schema by following https://tour.dgraph.io/moredata/1/\r\n2. Load the dataset with `dgraph live -r 1million.rdf.gz --zero localhost:5080`\r\n3. Shutdown and Restart dgraph zero and server to free up RAM.\r\n4. Apply the schema mutation at https://tour.dgraph.io/search/1/\r\n\r\nAfter the above 4 steps, the CPU usage is high about 40% busy when I don't do anything. I tried to shutdown and restart the dgraph zero and server many times. The CPU usage is always high when idle. It's not high all the time. It follows some kind of patterns. The CPU usage is high for several minutes, low for several minutes and then high again.\r\n\r\nThis never happens in pre v1.0.0 versions such as v0.9.4, v0.9.2 etc...\r\n\r\nBTW,  when I shutdown the dgraph server properly with `curl http://localhost:8080/admin/shutdown`, I always see the following snippet:\r\n\r\n```\r\ngoroutine 511 [running]:\r\ngithub.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.(*DB).sendToWriteCh(0xc420444300, 0x0, 0x0, 0x0, 0x10, 0x10, 0xc43218e460)\r\n    /home/travis/gopath/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/db.go:609 +0x15f\r\ngithub.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.(*DB).batchSet(0xc420444300, 0x0, 0x0, 0x0, 0x0, 0x10)\r\n    /home/travis/gopath/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/db.go:679 +0x4d\r\ngithub.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.(*DB).purgeVersionsBelow(0xc420444300, 0xc43345d290, 0xc43218e460, 0x10, 0x10, 0x8, 0x0, 0x0)\r\n    /home/travis/gopath/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/db.go:931 +0x453\r\ngithub.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.(*ManagedDB).PurgeVersionsBelow(0xc42014e138, 0xc43218e460, 0x10, 0x10, 0x8, 0x0, 0x0)\r\n    /home/travis/gopath/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/managed_db.go:79 +0x127\r\ngithub.com/dgraph-io/dgraph/posting.periodicPurgeOldVersions.func1()\r\n    /home/travis/gopath/src/github.com/dgraph-io/dgraph/posting/lists.go:244 +0x2a2\r\ngithub.com/dgraph-io/dgraph/posting.periodicPurgeOldVersions()\r\n    /home/travis/gopath/src/github.com/dgraph-io/dgraph/posting/lists.go:254 +0x40\r\ncreated by github.com/dgraph-io/dgraph/posting.Init\r\n    /home/travis/gopath/src/github.com/dgraph-io/dgraph/posting/lists.go:211 +0xe1\r\n```\r\n\r\nI am not sure if this is related or not. This never appears before version 1.0.\r\n\r\nOne more werid part in version 1.0.0 is if I remove `sleep 10` in the above script when I start dgraph, that means dgraph zero and server start at the same time. I can see about **9000 lines** of:\r\n\r\n```\r\n2017/12/19 15:39:27 groups.go:673: Error in oracle delta stream. Error: rpc error: code = Unknown desc = Node is no longer leader.\r\n```\r\n\r\nin the dgraph server log (stdout). \r\n\r\nI don't think this is expected and never see such behavior before version 1.0. I am not sure if I should open another bug for this or not. \r\n\r\nI attached three CPU profiles:\r\n\r\n[pprof.dgraph.samples.cpu.001.pb.gz](https://github.com/dgraph-io/dgraph/files/1571828/pprof.dgraph.samples.cpu.001.pb.gz)\r\n\r\n[pprof.dgraph.samples.cpu.002.pb.gz](https://github.com/dgraph-io/dgraph/files/1571830/pprof.dgraph.samples.cpu.002.pb.gz)\r\n\r\n[pprof.dgraph.samples.cpu.003.pb.gz](https://github.com/dgraph-io/dgraph/files/1571865/pprof.dgraph.samples.cpu.003.pb.gz)\r\n"},"comment":{"url":"https://api.github.com/repos/dgraph-io/dgraph/issues/comments/363113588","html_url":"https://github.com/dgraph-io/dgraph/issues/1938#issuecomment-363113588","issue_url":"https://api.github.com/repos/dgraph-io/dgraph/issues/1938","id":363113588,"user":{"login":"samhuss","id":562034,"avatar_url":"https://avatars2.githubusercontent.com/u/562034?v=4","gravatar_id":"","url":"https://api.github.com/users/samhuss","html_url":"https://github.com/samhuss","followers_url":"https://api.github.com/users/samhuss/followers","following_url":"https://api.github.com/users/samhuss/following{/other_user}","gists_url":"https://api.github.com/users/samhuss/gists{/gist_id}","starred_url":"https://api.github.com/users/samhuss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samhuss/subscriptions","organizations_url":"https://api.github.com/users/samhuss/orgs","repos_url":"https://api.github.com/users/samhuss/repos","events_url":"https://api.github.com/users/samhuss/events{/privacy}","received_events_url":"https://api.github.com/users/samhuss/received_events","type":"User","site_admin":false},"created_at":"2018-02-05T15:12:48Z","updated_at":"2018-02-05T15:12:48Z","author_association":"NONE","body":"The commands below work only when executed directly to console but never inside docker-compose (attached)\r\n\r\nI'm using dgraph/dgraph:master updated Feb 5\r\nstill sever can not catch up with zero and gives the previous error, however currently I'm running the instance using the following commands to run :master\r\n\r\n\r\ndocker run --rm -it -p 8081:8081 -p 8080:8080 -p 9080:9080 -v ~/dgraph:/dgraph --name dgraph dgraph/dgraph:master dgraph zero --port_offset=-2000\r\n\r\ndocker exec -it dgraph dgraph server --bindall=true --memory_mb 1048 --zero localhost:3080\r\n\r\ndocker exec -it dgraph dgraph-ratel\r\n\r\n\r\n[dc-master.yml.txt](https://github.com/dgraph-io/dgraph/files/1695607/dc-master.yml.txt)\r\n"}}
{"actor":{"display_login":"samhuss"}}