1 min readOct 10, 2017
Sorry to say that, but if you’re dealing with connection pools and prepared statements at this stage, maybe Go isn’t a good choice for you. Try something with more built-in solutions, like SpringBoot or even NodeJS. Those already have best practices built in, and you don’t need to invent the wheel, as you had to.
And you’re running out of connections simply because your architecture is wrong. You should have a small amount of constantly running workers consuming the same channel, and preferably writing to DB in batches.