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

low get performance when use auth #3223

Closed
qmhu opened this Issue Aug 5, 2015 · 13 comments

Comments

8 participants
@qmhu

qmhu commented Aug 5, 2015

When enable auth for etcd, request latency increase a lot. the test result is as below:

test env: Ubuntu14.04 Server virtual machine+16G
test case: php script to put a value in etcd and send 100 sequence get request and record the time cost for 100 get request then calculate average latency for every get request.

http: 0.0006s
http+auth: 0.14s
https: 0.08s
https+auth:0.17s

besides, enable https in etcd also make latency increase a lot.

@xiang90 xiang90 added the performance label Aug 5, 2015

@yichengq

This comment has been minimized.

Show comment
Hide comment
@yichengq

yichengq Aug 5, 2015

Contributor

The cause is that we use bcrypt to hash the password, and it needs ~100ms to check the password could match the hash value.

Any idea to improve this? @barakmich

Contributor

yichengq commented Aug 5, 2015

The cause is that we use bcrypt to hash the password, and it needs ~100ms to check the password could match the hash value.

Any idea to improve this? @barakmich

@qmhu

This comment has been minimized.

Show comment
Hide comment
@qmhu

qmhu Aug 7, 2015

any ideas?
my project is a web project which build by php + wordpress and I need get some config from etcd, i want to perceive config change from etcd real time. so I have to get config very frequently.

but consider 0.17s every request's latency, I have to reduce request to etcd as much as possible.

qmhu commented Aug 7, 2015

any ideas?
my project is a web project which build by php + wordpress and I need get some config from etcd, i want to perceive config change from etcd real time. so I have to get config very frequently.

but consider 0.17s every request's latency, I have to reduce request to etcd as much as possible.

@citywander

This comment has been minimized.

Show comment
Hide comment
@citywander

citywander Aug 9, 2015

Maybe you can cache, plaintext and hash.

citywander commented Aug 9, 2015

Maybe you can cache, plaintext and hash.

@xiang90 xiang90 added this to the v2.2.0-rc0 milestone Aug 10, 2015

@xiang90

This comment has been minimized.

Show comment
Hide comment
@xiang90

xiang90 Aug 10, 2015

Contributor

@qmhu @citywander We are going to investigate more and try to solve it soon. Stay tuned.

Contributor

xiang90 commented Aug 10, 2015

@qmhu @citywander We are going to investigate more and try to solve it soon. Stay tuned.

@xiang90 xiang90 self-assigned this Aug 10, 2015

@xiang90

This comment has been minimized.

Show comment
Hide comment
@xiang90

xiang90 Aug 17, 2015

Contributor

@philips @barakmich Any opinion on this one? We can either cache the result or just use plain test as password (does etcd really need to protect the passwords stored in it?)

Contributor

xiang90 commented Aug 17, 2015

@philips @barakmich Any opinion on this one? We can either cache the result or just use plain test as password (does etcd really need to protect the passwords stored in it?)

@barakmich

This comment has been minimized.

Show comment
Hide comment
@barakmich

barakmich Aug 17, 2015

Contributor

NO. We should not save passwords in plaintext. Come on, guys. Bcrypt is there for a reason. Now, that said...

Basic Auth is sending plaintext on the wire. This is why we have TLS. If you generate a bearer token (a la OAuth) after the first auth and store it etcd-side with a TTL, you can get a plaintext token, the comparison speedup that will eventually timeout gracefully. So your first request will still be ~100ms, but the subsequent ones can be considerably faster.

Contributor

barakmich commented Aug 17, 2015

NO. We should not save passwords in plaintext. Come on, guys. Bcrypt is there for a reason. Now, that said...

Basic Auth is sending plaintext on the wire. This is why we have TLS. If you generate a bearer token (a la OAuth) after the first auth and store it etcd-side with a TTL, you can get a plaintext token, the comparison speedup that will eventually timeout gracefully. So your first request will still be ~100ms, but the subsequent ones can be considerably faster.

@xiang90

This comment has been minimized.

Show comment
Hide comment
@xiang90

xiang90 Aug 17, 2015

Contributor

@barakmich If we do want the security, the bcrypt is probably the only option and the slowness is one of its feature.

To speedup, we need to go the plaintext token way. It changes both the server side and client side. If we go that way, we probably need to move this to a lower priority for 2.2 release.

Contributor

xiang90 commented Aug 17, 2015

@barakmich If we do want the security, the bcrypt is probably the only option and the slowness is one of its feature.

To speedup, we need to go the plaintext token way. It changes both the server side and client side. If we go that way, we probably need to move this to a lower priority for 2.2 release.

@xiang90 xiang90 added the Help Wanted label Aug 17, 2015

@xiang90

This comment has been minimized.

Show comment
Hide comment
@xiang90

xiang90 Aug 24, 2015

Contributor

Lower priority of this issue since this is not a block, but a performance improvement. I am still not sure which is the best way to solve it.

/cc @philips @yichengq @barakmich @citywander @qmhu Any suggestion would be appreciated.

Contributor

xiang90 commented Aug 24, 2015

Lower priority of this issue since this is not a block, but a performance improvement. I am still not sure which is the best way to solve it.

/cc @philips @yichengq @barakmich @citywander @qmhu Any suggestion would be appreciated.

@xiang90 xiang90 removed this from the v2.2.0-rc0 milestone Aug 24, 2015

@qmhu

This comment has been minimized.

Show comment
Hide comment
@qmhu

qmhu Aug 31, 2015

From my side, we can't stand for 0.1s+'s latency for every request. I support using plaintext but enable cache in server side is fine to me as long as the latency can regain back to a normal level.

by the way, if etcd can support multiple get, we can reduce the get request times,and this will help to improve my site's performance.

@xiang90 @barakmich

qmhu commented Aug 31, 2015

From my side, we can't stand for 0.1s+'s latency for every request. I support using plaintext but enable cache in server side is fine to me as long as the latency can regain back to a normal level.

by the way, if etcd can support multiple get, we can reduce the get request times,and this will help to improve my site's performance.

@xiang90 @barakmich

@thepwagner

This comment has been minimized.

Show comment
Hide comment
@thepwagner

thepwagner Oct 6, 2015

In the HTTPS case, why not pull the "username" from the client's X509 DN?

That would sidestep the bcrypt() bottleneck, and smarter clients could KeepAlive to perform multiple requests with a fixed authentication cost.

thepwagner commented Oct 6, 2015

In the HTTPS case, why not pull the "username" from the client's X509 DN?

That would sidestep the bcrypt() bottleneck, and smarter clients could KeepAlive to perform multiple requests with a fixed authentication cost.

@roboll

This comment has been minimized.

Show comment
Hide comment
@roboll

roboll Nov 25, 2015

Contributor

#3916 implements authentication using common name, that should solve this.

Contributor

roboll commented Nov 25, 2015

#3916 implements authentication using common name, that should solve this.

@xiang90

This comment has been minimized.

Show comment
Hide comment
@xiang90

xiang90 Jul 21, 2016

Contributor

closed by #5991

Contributor

xiang90 commented Jul 21, 2016

closed by #5991

@xiang90 xiang90 closed this Jul 21, 2016

@ZeaLoVe

This comment has been minimized.

Show comment
Hide comment
@ZeaLoVe

ZeaLoVe Mar 22, 2017

@xiang90 Could you please tell me how this problem solved? any docs?
I tried version 3.1, performance still bad. In my case, I try to use etcd with http+auth.

ZeaLoVe commented Mar 22, 2017

@xiang90 Could you please tell me how this problem solved? any docs?
I tried version 3.1, performance still bad. In my case, I try to use etcd with http+auth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment