{"action":"closed","issue":{"url":"https://api.github.com/repos/PowerDNS/pdns/issues/658","labels_url":"https://api.github.com/repos/PowerDNS/pdns/issues/658/labels{/name}","comments_url":"https://api.github.com/repos/PowerDNS/pdns/issues/658/comments","events_url":"https://api.github.com/repos/PowerDNS/pdns/issues/658/events","html_url":"https://github.com/PowerDNS/pdns/issues/658","id":13684994,"number":658,"title":"Excessive memory new/deletes - SOAData","user":{"login":"Habbie","id":525838,"avatar_url":"https://avatars.githubusercontent.com/u/525838?v=3","gravatar_id":"","url":"https://api.github.com/users/Habbie","html_url":"https://github.com/Habbie","followers_url":"https://api.github.com/users/Habbie/followers","following_url":"https://api.github.com/users/Habbie/following{/other_user}","gists_url":"https://api.github.com/users/Habbie/gists{/gist_id}","starred_url":"https://api.github.com/users/Habbie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Habbie/subscriptions","organizations_url":"https://api.github.com/users/Habbie/orgs","repos_url":"https://api.github.com/users/Habbie/repos","events_url":"https://api.github.com/users/Habbie/events{/privacy}","received_events_url":"https://api.github.com/users/Habbie/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PowerDNS/pdns/labels/auth","name":"auth","color":"eb6420"},{"url":"https://api.github.com/repos/PowerDNS/pdns/labels/enhancement","name":"enhancement","color":"cccccc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2013-04-26T11:36:59Z","updated_at":"2015-10-01T13:14:04Z","closed_at":"2015-10-01T13:14:04Z","body":"Hi there,\r\n\r\nAs part of some profiling I was doing I noticed that pdns is doing a *lot* of new/delete's on each query, to the point of on my system at least the highest cpu users according to perf top are malloc/free, and using google's tcmalloc provides some reasonably significant performance improvement. I'd estimate if you could eliminate most of these worst offenders, you could see a 20% performance improvement in powerdns. I used the following tool to profile memory usage for these reports:\r\n\r\nvalgrind --tool=exp-dhat --show-top-n=200\r\n\r\nI'm going to raise a few tickets now one for each area where we could see a performance improvement.\r\n\r\nThe first area is with the storing/parsing of SOAData - serializeSOAData and fillSOAData. Many backends can probably provide you with SOAData just as a string that could be passed back directly to the client, however every time you split it up to fill the SOAData struct, parse the strings and then recombine them later. Perhaps turning this into a class which can handle things a bit more intellegently through accessors (ie store as a string unless access to a particular value is required) would be good - it would cut down on a large number of new/delete's each cycle.\r\n\r\nMark"}}