which one is the best for mysql connection? -


here question below.

case 1:

always make connection or disconnection every tcp client.

case 2:

only make 1 connection , share connection every tcp client.

which 1 best performance? thanks!

i assume architecture n-tier, like:
db_server <---> application <----> many_clients
...and consider solution in application part?
assuming so, still depends:

  1. from performance point of view better have fewer connections. gain of squeezing multiple client requests single connection may small if network has low latency between db_server , application.
  2. the logic of application ensure single (multiplexed) connection can simple, if every client requires 1 query. may complex if communication clients requires doing many sql queries, , if intervene. cost (in terms of aplication complexity) may out-weight small benefits in network performance.

so have consider gain , cost... result depends heavily on both above factors.

of course, can hit connection-table size limit if consider many concurrent connections. or may have securitiy-specific connection limitation between db_server , application. in such cases multiplexing client connection 1 may option.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -