Package: nudnik
NudnikGoalsAllow easy testing of load-balancing and failures in gRPC and REST based service-meshFeaturesRate limitingFake IO load from either client or server sideExport timing metrics to a file or InfluxDB with any custom formattingQuick StartInstall Nudnik:# Install packagepipinstallnudnikRun example Server:nudnik--serverRun a client that identifies itself asbarbaz, fork to2threads, each sending5gRPC messages every3seconds.nudnik--namebarbaz--streams2--interval3--rate5Docker - Quick StartRunning on your local/remote docker daemon using docker-compose:docker-compose upUnder The HoodThe server binds to the host:port that were specified, and listens to incoming gRPC messages.
Every message consists of several fields:name: The name of the client, arbitrary stringstream_id: The stream id, the streams are numbered from0to whatever was configureed via thestreamsarg.message_id: At everyinterval, the client sendsratemessages, this id is an autoincrement index for that message.ctime: The timestamp at which the request was createdrtime: The timestamp at which the request was retransmitted (0 if not applicapble)rcount: The amount of times this message was retransmitted (0 if not applicapble)meta: Just another string field that does nothing, you may send additional arbitrary data to increase message size or specifyrandomto generate random data with every requestload: This field may be repeated several times, it instructs the server to create fake load of some sort before replying.Upon recieveing a message, the server will:parse theloadfieldperform the required loadprint a log message using the configuredout_formatreply anOKto the client, also add the fieldptime, which represents the time at which the request was parsed at the server,
this allows the client to calculate exact RTT, even if NTP is not synchronized.Local DevelopmentAs a rule of thumb wed'e recommend using virtualenv.
Requirement are Python 3.7 + requirements.txt fileClone and initialize Nudnik:# Install python requirementspipinstallgrpciogrpcio-toolsrequests-unixsocket# Clone and configure the repositorygitclonehttps://github.com/salosh/nudnik.git
gitconfig--globalpush.defaultmatching
gitconfig--globaluser.name"Your Name"gitconfig--globaluser.emailyour.email@salosh.org# "Compile" the entity protobufcdnudnik
python-mgrpc_tools.protoc--proto_path=./nudnik/--python_out=./nudnik/--grpc_python_out=./nudnik/./entity.protoConfigureConfigurationdocumentationFormattingdocumentationViaNudnikCommand line args:nudnik-h
usage:nudnik[-h][--config-fileCONFIG_FILE][--hostHOST][--portPORT][--server][--nameNAME][--name-mismatch-error{prefix,suffix,exact}][--metaMETA][--workersWORKERS][--streamsSTREAMS][--initial-stream-indexINITIAL_STREAM_INDEX][--intervalINTERVAL][--rateRATE][--countCOUNT][--chaosCHAOS][--loadload_typeload_value][--retry-countRETRY_COUNT][--fail-ratioFAIL_RATIO][--ruok][--metrics{stdout,file,influxdb,prometheus}][--stats{stdout,file,influxdb,prometheus}][--extraEXTRA][--debug][--verbose][--version]Nudnik-gRPCloadtester

optionalarguments:-h,--helpshowthishelpmessageandexit--config-fileCONFIG_FILE,-fCONFIG_FILEPathtoYAMLconfigfile--hostHOST,-HHOSThost--portPORT,-pPORTport--server,-SOperationmode(default:client)--nameNAME,-nNAMEParsername--name-mismatch-error{prefix,suffix,exact}Failrequestonnamemismatch(default:None)--metaMETA,-MMETASendthisextradatawitheveryrequest--workersWORKERS,-wWORKERSNumberofworkers(Default:CountofCPUcores)--streamsSTREAMS,-sSTREAMSNumberofstreams(Default:1)--initial-stream-indexINITIAL_STREAM_INDEXCalculatestreamIDfromthisinitialindex(Default:0)--intervalINTERVAL,-iINTERVALNumberofsecondsperstreammessagecycle(Default:1)--rateRATE,-rRATENumberofmessagesperinterval(Default:10)--countCOUNT,-CCOUNTCountoftotalmessagesthatshouldbesent(Default:0==unlimited)--chaosCHAOS,-cCHAOSComputestatisticalprocesslevelrandomcrashes[0,3600/interval](Default:0)--loadload_typeload_value,-lload_typeload_valueAddartificialload[rtt,rttr,cpu,mem,cmd,fcmd](Default:None)--retry-countRETRY_COUNTNumberoftimestore-sendfailedmessages(Default:-1,whichmeansinfinitetimes)--fail-ratioFAIL_RATIOPercentofrequeststointentionallyfail(Default:0)--ruok,-REnable"Are You OK?"HTTP/1.1API(default:False)--metrics{stdout,file,influxdb,prometheus},-m{stdout,file,influxdb,prometheus}Enablemetricsoutputs(Default:None)--stats{stdout,file,influxdb,prometheus},-t{stdout,file,influxdb,prometheus}Enablestatsoutputs(Default:None)--extraEXTRA,-eEXTRAExtraargs(Default:None)--debug,-dDebugmode(default:False)--verbose,-vVerbosemode,specifymultipletimesforextraverbosity(default:None)--version,-VDisplayNudnikversion2018(C)SaloShp<https://github.com/salosh/nudnik.git>Via config file:nano./config.ymlGetting startedPlease refer to ourexamples repositoryfor multiple guides and usage examplesVisit our website athttps://salosh.org