这是indexloc提供的服务,不要输入任何密码
Skip to content

如果当前key可用,则先用当前key,增加可用性 #253

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

repSu
Copy link

@repSu repSu commented Jul 25, 2025

当前每次都会去随机获取key有好处也有坏处。
好处是,每个人每次请求都可能有机会碰到可用的key,坏处是每次请求都可能需要很多次请求才能找到可用的key。

因此我的想法是,如果好不容易找到了一个可用的key,应该优先使用这个可用的key,这样至少可以保证最近的10次或者20次或者50次请求可以成功,而不是每次都可能不一定成功,这个可用的key不能用后再去碰运气按理来说,效果不会比当前的效果差,毕竟有10个人成功后,第11个人才失败的。

我唯一能想到的可能不如之前的效果的场景是极端场景,大并发访问,一秒就把这个key的rpm达到了导致它不可用了,比如一秒有100个人访问,rpm是50,那么这种情况下,他们中有50人可以从成功,另外50人中的部分人,可能会额外多了一次key的试错,但是理论上应该也只是少量人会多一次key试错才对。

我没有仔细去看rpm的值是多少,上面数字都只是举例子说明问题用的,如果数字不对,望包涵。

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

Successfully merging this pull request may close these issues.

2 participants