I just wondered what the fastest way to connect to MySQLi is? I have yet to find a stackoverflow post on this, if there is even a fastest way or if every way is faster, I really want to milk the speed for all it is with my application.
2条回答 默认 最新
- doukang7501 2016-03-09 14:28关注
You don't need a HandlerSocket.
- HandlerSocket is a MySQL plugin that implements a NoSQL protocol for MySQL.
- Allows applications to communicate more directly with MySQL storage engines, without the overhead associated with using SQL.
From the docs:
Once HandlerSocket has been downloaded and installed on your system, there are two steps required to enable it.
First, add the following lines to the [mysqld] section of your my.cnf file:
loose_handlersocket_port = 9998 # the port number to bind to for read requests loose_handlersocket_port_wr = 9999 # the port number to bind to for write requests loose_handlersocket_threads = 16 # the number of worker threads for read requests loose_handlersocket_threads_wr = 1 # the number of worker threads for write requests open_files_limit = 65535 # to allow handlersocket to accept many concurrent # connections, make open_files_limit as large as # possible.
Second, log in to mysql as root, and execute the following query:
mysql> install plugin handlersocket soname 'handlersocket.so';
I agree @Your Common Sense that using a HandlerSocket is NOT even needed. Unless your a major corporation and every second counts.
The fastest, normal way to connect
$db = mysqli_connect("localhost","my_user","my_password","my_db"); $db->query("...");
How much speed do you actually need? If you need corporate size speed, I can help you with HandlerSocket. My guess is that you'll be just fine with standard MYSQLi connection.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
- ¥20 怎么用dlib库的算法识别小麦病虫害
- ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
- ¥15 java写代码遇到问题,求帮助
- ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
- ¥15 有了解d3和topogram.js库的吗?有偿请教
- ¥100 任意维数的K均值聚类
- ¥15 stamps做sbas-insar,时序沉降图怎么画
- ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
- ¥15 关于#Java#的问题,如何解决?