当前位置:网站首页>Leaderboard design in game server

Leaderboard design in game server

2022-07-23 21:35:00 zfoo-framework

In fact, it's all to reduce IO Some optimization of number lock , Even if it's :Redis, You can't always visit .

Now , Can combine

First from Redis Read leaderboard information , Then save it to memory List in .

List and expireTime, Later attempts to get on the list , Is to directly put the data to be updated into List in , And then sort it , Yes, of course , Due to the problem of multithreading , Need to add read-write lock .

As the number of visits increases , More visits , It will naturally refresh all the data to Redis in , This greatly reduces redis Frequency of visits .

------------------

Think again : The creation of deadlock

Actually, deadlock , There must be circular waiting , You wait for me to release resources , I wait for you to release resources . But the read-write lock , Fight for the lock , It is impossible to compete at the same time , therefore , Must be thread safe .

原网站

版权声明
本文为[zfoo-framework]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207232002219246.html