开发者

Why with PHP hundreds of DB connections dont matter..but in C++ app they do?

开发者 https://www.devze.com 2023-01-06 20:54 出处:网络
In most web (PHP) apps, there is mysql_connect and some D开发者_运维技巧B actions which means that if 1000 users is connected, 1000 connections are opened?

In most web (PHP) apps, there is mysql_connect and some D开发者_运维技巧B actions which means that if 1000 users is connected, 1000 connections are opened? But with C++ app it is incredibly slow...what is the main difference? Thanks


PHP will automatically close the DB connections when the script terminates (unless you use persistent connections or have closed the connection yourself before the script terminates of course). In your C++ app, this will depend on how you actually handle connections. But I can imagine you will want to keep your connections open for a longer stretch of time in the C++ app, and thus you could hit the maximum number of concurrent users sooner.

You could also tweak some of the MySQL settings if you have performance issues.

But how are you accessing MySQL from your C++ app? Not using ODBC are you?

0

精彩评论

暂无评论...
验证码 换一张
取 消