-
Notifications
You must be signed in to change notification settings - Fork 103
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
Performance optimization #632
Conversation
…le connection and now we have almost linear scalability on 2K-32K connections; also remove old debug prints
…comment by results of benchmarks and profiling: we have serious performance issues somewhere in cache
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.
Looks good to me. Just a few minor notes.
* Queue the cache work if it must be server by remote node only. | ||
* Otherwise we can do everything right now on local CPU. | ||
*/ | ||
if (likely(req->node == numa_node_id())) { |
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.
It appears that req->node
is not really needed and can be eliminated from TfwHttpReq{}
structure. It's only used in the call to tfw_cache_sched_cpu()
below, and it can easily be replaced by a local variable here (say, nodeid
) that can be passed to that function to get the cpu
. The only other place where it's used is tfw_cache_add()
in a fresh new BUG_ON()
that has only appeared in this patch and was not there before.
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.
} | ||
else { | ||
cache_req_process_node(req, action); | ||
} |
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.
Actually, this whole code block doesn't require curly braces as all statements are single-line.
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.
Usually we use curly braces in comples if-else statements: https://github.com/tempesta-tech/linux-4.1.27-tfw/blob/master/Documentation/CodingStyle#L141
if (ret) | ||
return tfw_http_send_404(req); | ||
else | ||
return tfw_http_send_200(req); |
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 know that this is the way it was, but perhaps it can be changed to something like this?
return ret
? tfw_http_send_404(req)
: tfw_http_send_200(req);
default: | ||
return tfw_http_send_403(req); | ||
/* | ||
* Queue the cache work if it must be server by remote node only. |
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.
Queue the cache work only when it must be served by a remote node.
Do not queue cache work for local CPU: 25% better performance on single connection and now we have almost linear scalability on 2K-32K connections; also remove old debug prints