Skip to content

Improving server_info #610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

SinisterLight
Copy link

Improving server_info object by parsing the db* keys of redis-info.
earlier it was
server_info = { ..
db0: 'keys=1,expires=0,avg_ttl=0',
db9: 'keys=49,expires=49,avg_ttl=2588996447',
.. }
changed this to
server_info = { ..
db0: { keys: '1', expires: '0', avg_ttl: '0' },
db9: { keys: '49', expires: '49', avg_ttl: '2588996447' }
..}

@brycebaril
Copy link
Contributor

Pondering the performance implications.

One downside is that even though in most long-lived connections (normal use case) it will be very apparent in the benchmarks, which call INFO a lot (INFO is called on every connection)

@BridgeAR
Copy link
Contributor

BridgeAR commented Sep 8, 2015

@brycebaril I doubt that this is going to impact the performance in a measurable way as there are only very few lines that will be parsed in the special way (most of the time it'll just be one). It might be a very tiny speed improvement to only iterate over the keyspace part e.g.

var i = 0;
var key = 'db' + i;
while (obj[key]) {
  var sublines = obj[key].split(',');
  // do stuff with the keyspace ...
  i++;
  key = 'db' + i;
}

And we could improve the performance of the info call further by removing the .forEach. That of course, is independent from this merge request.
So I'd say this is fine if it's going to be rebased, but I do not have a strong opinion about this.

BridgeAR added a commit that referenced this pull request Sep 17, 2015
Improve server keyspace info in .server_info. Closing #610. Thx to @SinisterLight
@BridgeAR
Copy link
Contributor

Git got fixed by #855

Thx @SinisterLight

@BridgeAR BridgeAR closed this Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants