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 loading the botnames from a cache #489

Conversation

hermensbas
Copy link
Contributor

@hermensbas hermensbas commented Aug 21, 2024

GenderRaceBotNames retrieved from a cache instead of using a DB call per name on a 100k record table 'playerbots_names'.
The name fallback is still in place but had to replace to IN_USE mechanism with a inner join. The IN_USE enforced cache still need to make the IN_USE db call which took a huge performance hit. Before 1-2 seconds per account creation, now a few seconds for 100's of accounts.

Tested with cache and without the cache enabled and with fallback mechanism active.

@hermensbas hermensbas marked this pull request as ready for review August 21, 2024 18:30
@hermensbas hermensbas changed the title Loading the botnames from a cache Performance loading the botnames from a cache Aug 21, 2024
@Rozza122
Copy link

Rozza122 commented Aug 21, 2024

GenderRaceBotNames retrieved from a cache instead of using a DB call per name on a 100k record table 'playerbots_names'. The name fallback is still in place but had to replace to IN_USE mechanism with a inner join. The IN_USE enforced using the cache still to make a DB which took a huge performance hit. Before 1-2 seconds per account creation, now a few seconds for 100's of accounts.

Tested with cache and without the cache enabled with fallback mechanism active.

adding a new index to playerbots name increases speed slightly too:

time with no index 337ms~, with new index 58ms~.

Query ran:
SELECT n.name
FROM acore_characters.playerbots_names n
LEFT OUTER JOIN acore_characters.characters c ON c.name = n.name
WHERE c.guid IS NULL and n.gender = '8'
ORDER BY RAND() LIMIT 1;

New Index:
ALTER TABLE acore_characters.playerbots_names
ADD UNIQUE INDEX name(name, gender);

…ts_names table and added an additional index for the fallback
@hermensbas
Copy link
Contributor Author

Good point, just in case when the fallback is being used and tiny bit faster when loading the cache. Also noticed i didnt cleanup the in_use from the playerbots_names.sql. Thanks :)

@liyunfan1223 liyunfan1223 merged commit 1a8fcc6 into liyunfan1223:master Aug 22, 2024
5 checks passed
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.

3 participants