AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [ANY]A clientprefs replacement for sourcemod using Redis as backend (https://forums.alliedmods.net/showthread.php?t=313958)

kiceqs 01-29-2019 14:31

[ANY]A clientprefs replacement for sourcemod using Redis as backend
 
clientprefs-redis

A clientprefs extension for sourcemod using Redis as backend.

This plugin is truly mutilthreaded.

Unlike the offical clientprefs only use signle thread for query and getting stuck if there are too many cookies (or other SQL queries), this implementation use a lock-free queue (Thanks to Cameron) and a thread pool to minimize delay and maximize QPS.

Most clients are able to get their cookies before they finish loading the maps, even with 64 player and thousands of cookies, which the orginial implementation can take more than 10 minutes to load.

If the server take super long time to load cookies or threaded SQL queries can take days to return, this plugin might be a nice choice.

Thanks to XNet for long term testing, which they have substantial cookies for their plugins. Before using this plugin, it will take up to 10 minutes to load all cookies; now, it just cost less than a minute to finish loading.

I only test this plugin in Windows, but it should work under Linux.

Installaion

Download the file from here (https://github.com/kice/clientprefs-redis/releases). Just copy the .dll file to sourcemod/extensions, remember to backup the orginial clientprefs.ext.dll file.

No other change was needed. Existing code can still work, but you might loss all your existing cookies data.

Config Redis connection infomation

Add a new config in sourcemod/configs/databases.cfg

PHP Code:

"clientprefs_redis"
{
    
"driver"  "redis"
    "host"    "127.0.0.1"
    "pass"    "foobared233"


Want to save existing data?

You can port existing data to the target redis database, but you have to follow the new data format. See the code for more infomation.

How to complie

Windows
Prerequisites
First complie Microsoft's native port of redis. Copy the hiredis.lib and Win32_Interop.lib to clientprefs-redis/lib/Win32/Release or clientprefs-redis/lib/Win32/Debug folder.

Or You can use my prebuild library.

Build Configurations
You need to enable C++17 feature to complie the code.

Linux
// TODO

Benchmark

There is a test plugin(https://github.com/kice/clientprefs-...esSpeedTest.sp) can benchmark the loading time.

Source: https://github.com/kice/clientprefs-redis

Also see

[ANY]A clientprefs replacement for sourcemod using Redis as backend

[ANY] A Hiredis warpper for Sourcemod

Lux 02-16-2019 13:44

Re: [ANY]A clientprefs replacement for sourcemod using Redis as backend
 
kiceqs This looks so nice :D
Ill be happy to do testing once linux is supported.

Looking forward to your progress:3

ttasdasda 02-18-2019 08:40

Re: [ANY]A clientprefs replacement for sourcemod using Redis as backend
 
Could someone please compile this for Linux? Sounds exactly what I need

Agent Wesker 03-01-2019 21:33

Re: [ANY]A clientprefs replacement for sourcemod using Redis as backend
 
Was this compiled for Sourcemod 1.10 ?

I get error [SM] Unable to load extension "clientprefs.ext": Could not find interface: ISourceMod

Using SM 1.9 - build 6275

Agent Wesker 12-02-2019 13:39

Re: [ANY]A clientprefs replacement for sourcemod using Redis as backend
 
Edit: I got this running in SM 1.10 but there is no debug info printed in regards to the redis database; if it loses connection or can't connect for example.

Would be nice if there was a separate config file with debug setting.


All times are GMT -4. The time now is 14:26.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.