Too many connections to DB, how to optimize

And in number of rows?