Redis Sentinel C# Client -
i've got 3 redis servers, 1 master & 2 slaves. 1 sentinel running, monitoring them well. promote whichever instance when required , smooth.
the problem have communicating c#. googling, appear csredis supports sentinel retrieving slaves/masters. using code this...
//create manager, has sentinels in (this have 3 when go live) redissentinelmanager sentman = new redissentinelmanager("localhost:26379"); //get slave, these read-only sentman.getslave("mymaster", 100, 100); //get master, storing object sentman.getmaster("mymaster", 100, 100);
this works, absolutely fine , various responses change when kill instance. however, it's incredibly slow!
if create manager , try , slave 5 times, takes around 1second per slave request, crazy slow. have noticed, first request very, fast. see code below...
//try , 5 slaves ( int = 0; < 5; ++ ) { stopwatch = stopwatch.startnew(); var slave = sentman.getslave("mymaster", 50, 50); if (slave == null) console.writeline("failed slave"); console.writeline("took " + a.elapsedmilliseconds.tostring() + "ms " + slave.host + ":" + slave.port); }
here output...
took 4ms localhost:6400 took 844ms localhost:6400 took 1007ms localhost:6400 took 999ms localhost:6400 took 994ms localhost:6400
which odd, first 1 4ms! it's taking age subsequent clients. try test, creating new sentinelmanager every loop item, faster? nope, same. first 1 quick, very slow.
am using library wrong, or have found bug? going try , grab source , step through it...
cheers guys...
i've found problem here, it's issue client. in it's dispose method it's taking around 1s dispose of async objects.
Comments
Post a Comment