Raised This Month: $12 Target: $400
 3% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kiceqs
Junior Member
Join Date: Jun 2015
Old 01-29-2019 , 14:31   [ANY]A clientprefs replacement for sourcemod using Redis as backend
Reply With Quote #1

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

Last edited by kiceqs; 01-29-2019 at 14:48.
kiceqs is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 02-16-2019 , 13:44   Re: [ANY]A clientprefs replacement for sourcemod using Redis as backend
Reply With Quote #2

kiceqs This looks so nice
Ill be happy to do testing once linux is supported.

Looking forward to your progress
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
ttasdasda
Member
Join Date: Apr 2014
Old 02-18-2019 , 08:40   Re: [ANY]A clientprefs replacement for sourcemod using Redis as backend
Reply With Quote #3

Could someone please compile this for Linux? Sounds exactly what I need

Last edited by ttasdasda; 02-18-2019 at 14:35.
ttasdasda is offline
Agent Wesker
Senior Member
Join Date: Apr 2012
Old 03-01-2019 , 21:33   Re: [ANY]A clientprefs replacement for sourcemod using Redis as backend
Reply With Quote #4

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 is offline
Agent Wesker
Senior Member
Join Date: Apr 2012
Old 12-02-2019 , 13:39   Re: [ANY]A clientprefs replacement for sourcemod using Redis as backend
Reply With Quote #5

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.

Last edited by Agent Wesker; 12-02-2019 at 15:47.
Agent Wesker is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:33.


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