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

本地hash方案 #4

Open
ZSMX opened this issue Nov 8, 2019 · 2 comments
Open

本地hash方案 #4

ZSMX opened this issue Nov 8, 2019 · 2 comments

Comments

@ZSMX
Copy link

ZSMX commented Nov 8, 2019

感觉最后可以加一步,当余票很少时,也许把用户id本地hash,少于多少(比如还有10张票,QPS1w,用hash值少于多少卡掉99%的请求,使qps就100(为余票个数*10)就行)的直接返空,直接显示售罄了,这样让大部分本地库存不用再去请求redis远程减库存。

@zhang570221322
Copy link

感觉最后可以加一步,当余票很少时,也许把用户id本地hash,少于多少(比如还有10张票,QPS1w,用hash值少于多少卡掉99%的请求,使qps就100(为余票个数*10)就行)的直接返空,直接显示售罄了,这样让大部分本地库存不用再去请求redis远程减库存。

感觉可以,但是用IP太不公平了吧,不如只用session,然后随机选1%放行。

@bluesonny
Copy link

先本地再执行远程

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants