-
Notifications
You must be signed in to change notification settings - Fork 60
Conversation
f39b7df
to
3608a47
Compare
Wow good catch. How huge is the performance boost roughly? |
Here are the results of a naïve test run without this change: With this new change: Working on a longer/bigger test now. |
I'm trying to understand why making the handle static would cause the
|
Actually, does it really need to be static? It looks like it can just be local to a
I think this solves the leak issue as well. |
Yep, that's exactly what I'm testing locally right now! I'm always scared of |
3608a47
to
0f878d2
Compare
Bigger test (AGL RPi image) without this change: With this new change: Not bad! ~12 minutes for ~100 MB isn't exactly awesome performance, but it's 1/3 the time it used to be. |
Reuse provides a huge performance boost because certs don't have to be re-read and fewer objects get destroyed and recreated. Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
0f878d2
to
d16c36a
Compare
It looks like a quite improvement. |
curlEasySetoptWrapper(easy_handle.get(), CURLOPT_VERBOSE, get_curlopt_verbose()); | ||
server_->InjectIntoCurl(path.string(), easy_handle.get()); | ||
curlEasySetoptWrapper(easy_handle.get(), CURLOPT_WRITEFUNCTION, &OSTreeHttpRepo::curl_handle_write); | ||
server_->InjectIntoCurl(path.string(), easy_handle_.get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance, it looks like the auth creds/certs are set for each request while it can be set once in the curl context and then just CURLOPT_URL
needs to be set for each request for an object so TCC/TLS connection is reused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the goal here is to make sure that TCP/TLS connection is reused for each request for both the downloading and pushing objects to Treehub. I suppose libcurl should do it by default as long as "_Then reusing the same easy handle will ensure it can reuse its connections.", but I am not sure if it works if we setup the creds in the "easy handle" for each request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did wonder if I should refactor that function, and there is room for some minor optimization there, but it seems like the connection is getting reused without messing with it, so I didn't change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I think further steps for the performance improvement are:
|
This seems possible but requires backend changes as well.
This isn't possible for the fetching because we don't know what we need to fetch until we walk the object hierarchy. For pushing, it's an option but I'm not sure it's worth it; it also requires backend changes. I'll add these suggestions to the ticket! |
Yes, it requires changes in BE for sure. |
Reuse provides a huge performance boost because certs don't have to be re-read and fewer objects get destroyed and recreated.