-
Notifications
You must be signed in to change notification settings - Fork 79
segment search regex leads to timeouts due to large return #246
Comments
I'm afraid the query you mention will work even worse than the current implementation. What Cassandra does is it picks the most selective index and queries it, filtering out the rest of results, even if there are more indexes available. Although after checking your query I've noticed two things:
I'm going to start with (2) right after I'm done with #244 |
I've tested an alternative tokeniser and I have good news: we most likely will be able to (yet again) significantly improve the performance. I'll still have to modify it to support |
Tokeniser impl (prototype) can be found in #249. |
I pulled in 248 and 249 to our test environment. Truncated my segment and metric table. Searching the tree seems snappy (but always does when i truncate). Will let it re-populate over a day or so. I am not able to retrieve metrics though. our "query" host is spamming this:
|
@tehlers320 do you have a full stack trace?.. |
@tehlers320 I've found the reason and pushed the fix to #248. Was incorrect arity usage from my side... |
I pulled in the #248 fix and pushed it into our environment. As @tehlers320 reported, the tree is snappy but now I'm seeing a different error when retrieving metrics.
|
@jacobrichard thanks for catching this one. Could you tell me what kind of queries are you running? |
This is just a metric retrieval from graphite-web. Specifically for one of the internal reporter metrics for cyanite: cyanite.us-west-2.$hostname.cyanite.ingestq.events.count I redacted hostname (since it was an IP), but thats the path to the metric from graphite-web |
@jacobrichard @tehlers320 right it was my bad. My usual testing path did not include For #248 i would not expect changes in performance yet (this is a job for #249), but I hope to finish both of them over this weekend. #248 only exposes |
Out of curiosity would the ElasticSearch index have had this problem as well ? |
Yes, this was only because we've included these names. It's only because of these "fake" metrics. For grafana, you would expect the metrics to pop up in autocomplete. For name expansion via graphite-web you don't, so that leads to the trouble.. |
Are we talking about the same issue, i mean the timeout issue due to the table being too big? |
You're right. It all boils down to what kind of wildcard is supported: if we can only query by prefix and/or suffix, it'll still be the same... Technically, we could have a Cyanite node-local index, but then we'd have synchronisation and / or update problems... |
It's really docker that makes this un-manageable i think. Our tree just grows infinitely since they change so often and make new trees over and over. stats.gauges.foo-app.ads1239adsfz The hash comes from the servername inside the container. We are kicking around an idea to have the host come online and "register" with something and then changing the name to "server001, server002" based on how many of the same nodes are up . I wonder if anybody has solved this problem already. Even with influxdb over time you would have millions of hostname tags. |
After a lot of back-and-forth I've figured how to use tokeniser for better and faster queries and more lightweight trees in #256 |
To reproduce
Grafana or graphite-api search:
prod.us-west-2.collectd_metrics.*.*.disk-*.disk_ops.write
Cyanite will query this:
SELECT * from segment WHERE pos = 8 AND segment LIKE 'prod.us-west-2.collectd_metrics.%' ALLOW FILTERING;
This data contains many metrics that we do not need for this query for example:
prod.us-west-2.collectd_metrics.caps-competition-api-web.9b95f0-ip-10-1-1-247.interface-eth0.if_octets
I tried to query for this but it doesn't seem supported in cassandra.
SELECT * from segment WHERE pos = 8 AND segment LIKE 'prod.us-west-2.collectd_metrics.%.disk_ops.write' ALLOW FILTERING;
Should cyanite consider using tags and i wonder how much this would grow the segment table size by ?
tags { "prod", "us-west-2", "collectd_metrics", "cyanite-cassandra", "ip-10-1-1-23", "disk-xvdf", "disk_ops", "write" }
Then the query could do this based on any '.' entry that is not a regex
i did not test this...
SELECT * FROM segment WHERE tags CONTAINS 'prod' AND tags CONTAINS 'us-west-2' AND tags 'collectd_metrics' AND tags CONTAINS 'disk_ops' AND tags CONTAINS 'write';
The text was updated successfully, but these errors were encountered: