If you can provide a running example that demonstrates how the database/sql 
package + driver opens more connections then db.SetMaxOpenConns specify, 
then it can be considered a bug and should be reported to 
https://golang.org/issue .

On Thursday, May 25, 2017 at 7:25:48 AM UTC-7, viridi...@gmail.com wrote:
>
> Hi All,
>
> I'm using go-sql-driver/mysql in my web-application. Each API call has 
> about 3-4 queries it performs. Which are all insert or fetch single row 
> queries like:
>
> _, err := db.Exec(query, parms)
>
>     if err != nil {
>         log.Fatal(err)
>         
>     }
>
> err := db.QueryRow(query, params).Scan(&data)
> if err != nil {
>         log.Fatal(err)
>         
>     }
>
> I have also the following configuration
> db.SetMaxOpenConns(50)
> db.SetMaxIdleConns(20)
>
> I am making a call to 2 api's which have a combined db call of 8 queires. 
>  When I make a call with 120 concurrent users with a ramp up time of 5 sec 
> i get Error 1040: Too many connections.
>
> it works fine for up to 90-100 users. My question is why does the db not 
> re-using the connections or why does it not release the connections soon 
> enough?
>
> As both Exec and QueryRow are supposed to release connections immediately 
> since I use Scan soon after, shouldn't the number of connections it support 
> be more in number than just double?
>
> Any insight is appreciated.
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to