dalerobbins

Results comments of dalerobbins

I load test with apache ab: ab -l -r -n 4000 -c 4000 -s 60 -H "Cookie: name=someusername;password=userpassword" http://192.168.1.100:3000/ My go http server simply checks for a user in mysql...

``` go func GetUserNamePassword(name, password string) (string, error) { var ( err error dbname = settings.GetSetting("dbName") dbuser = settings.GetSetting("dbUser") dbpass = settings.GetSetting("dbPass") retName string retPass string ) // Check for...

Ok, will try that and see what happens. Thanks.

``` go func GetUserNamePassword(name, password string) (string, error) { var ( err error dbname = settings.GetSetting("dbName") dbuser = settings.GetSetting("dbUser") dbpass = settings.GetSetting("dbPass") retName string retPass string ) // Check for...

I see your point, didn't realize that. I'll redo some code and open a permanent connection in a go init() function of my package then use the db object for...

``` go var ( err error db *sql.DB dbname string dbuser string dbpass string ) // Gets called once before using the database for http requests func OpenDB() error {...

![screenshot from 2015-07-13 16 32 14](https://cloud.githubusercontent.com/assets/10182381/8663389/1b9f423c-297f-11e5-9a81-32943dc904d7.png) Screenshot shows CPU load during test of simple sql query with 15000 concurrent connections running from apache bench.

![screenshot from 2015-07-13 20 29 48](https://cloud.githubusercontent.com/assets/10182381/8665873/36a16f0a-299e-11e5-99a2-443f6204cbe8.png) ~~Looks like the MySQL server needed to have back_log increased from it's default of 50. I set this to 1000 and the load test...

After adding a mutex to the GetUserNamePassword function, all is good. Test completes with no db errors within 4 sec's and 20000 concurrent connections. Forgot that each http request is...

``` go package database import ( "database/sql" "errors" _ "github.com/go-sql-driver/mysql" "httpserver/modules/settings" "sync" ) var ( err error db *sql.DB dbMutex = new(sync.RWMutex) dbname string dbuser string dbpass string ) //...