Skip to content
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

Merged
merged 3 commits into from
Nov 4, 2016
Merged

Performance optimization #632

merged 3 commits into from
Nov 4, 2016

Conversation

krizhanovsky
Copy link
Contributor

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

…le connection and now we have almost linear scalability on 2K-32K connections; also remove old debug prints
@krizhanovsky krizhanovsky added this to the 0.5.0 Web Server milestone Nov 3, 2016
…comment by results of benchmarks and profiling: we have serious performance issues somewhere in cache
Copy link
Contributor

@keshonok keshonok left a 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())) {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I add your comment to the code referencing #391. I don't want to remove it now, because the scheduling cache work is assumed to be redesigned in #391.

}
else {
cache_req_process_node(req, action);
}
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (ret)
return tfw_http_send_404(req);
else
return tfw_http_send_200(req);
Copy link
Contributor

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.
Copy link
Contributor

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.

@krizhanovsky krizhanovsky merged commit c6d2df4 into master Nov 4, 2016
@krizhanovsky krizhanovsky deleted the ak-perf-opt branch November 4, 2016 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants