package main /* * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return * ---------------------------------------------------------------------------- */ import ( "flag" "fmt" "time" ) func main() { hostPtr := flag.String("host", "", "Redis Server FQDN:port") usernamePtr := flag.String("username", "", "Redis Server username") passwordPtr := flag.String("password", "", "Redis user password") //dbPtr := flag.Int("db", 0, "Redis db, default 0") initializeDBPtr := flag.Bool("initialize", false, "Boolean initialize db, default false") ratePtr := flag.Int("rate", 50, "Test rate limit, default 30/sec") burstPtr := flag.Bool("burst", true, "Boolean burst test default true") //todo this should be off that same csv rather than an input maxEntriesPtr := flag.Int("dbEntries", 50000, "Test rate limit, default 50/sec") testDurationPtr := flag.Int("duration", 50, "Duration of each test") flag.Parse() host := *hostPtr username := *usernamePtr password := *passwordPtr //db := *dbPtr initializeDB := *initializeDBPtr rate := *ratePtr burst := *burstPtr keyMaxValue := *maxEntriesPtr durationInt := *testDurationPtr duration := time.Second * time.Duration(durationInt) pool := newPool(host, username, password) client := pool.Get() defer client.Close() if initializeDB { buildTestData(&client, 50000) } client.Close() //refreshing state for next test pool = newPool(host, username, password) client = pool.Get() defer client.Close() getRateTest(&client, rate, keyMaxValue, duration) client.Close() //refreshing state for next test pool = newPool(host, username, password) client = pool.Get() defer client.Close() if burst { getBurstTest(&client, rate, keyMaxValue, duration) } fmt.Println("Tests completed...") }