-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Allow (controlled) reuse of parsers again #14025
Comments
I wanted to get some feedback from @powersj and @srebhan about how to implement this. So, should |
So...my next question is...is there any easy way to tell which parsers are thread-safe? Is there any easy way to tell which fields for a given parser can be shallow-copied and where I need a deep copy? The idea of implementing Clone() for every parser class fills me with a certain amount of dread, especially if it means that I'm going to have to learn how each one works internally. |
Just wanted to add that I also encountered HUGE performance hit after #13886 has been merged |
@athornton, @srebhan, and myself met to discuss this today. The next steps involve:
The conclusion we reached was that the json_v2 has known issues around parsing data in a thread safe manner, resulting in #13886. However, this has impacted performance and other parsers that have state too much. Hence the revert. For json_v2, we are going to add some blocking into the parse function in order to mitigate issues that were seen, without impact other parsers for now. Then additional work can occur later to better understand what is wrong specifically with json_v2. Finally, in order to have real data around the parser performance, we want to add some benchmark functions around each parse function. This way we can get some idea of the performance for any given release. |
Use Case
After #13886 was merged, and we deployed a rebased telegraf instance, our performance took a nosedive. We realized it was because we were making a network call to our Schema Registry with every single measurement, because now we're creating a new Avro parser object each measurement, and therefore the schema cache, which is inside the parser, is always empty.
Expected behavior
We expected performance to stay about the same: one call to the registry per schema ID (there are many, many more measurements than distinct schemas).
Actual behavior
We're hitting the schema registry on each measurement, which is very slow, creates a huge load on the schema registry, and gobbles up a lot of memory for all of the simultaneously-open TCP connections.
Additional info
A little discussion on the InfluxDB Slack resulted in this suggested from @srebhan :
So I intend to add the
Clone()
interface to the Avro parser, and then take a look at what needs doing to plumb that into the generic create-a-parser logic.The text was updated successfully, but these errors were encountered: