Starkis a library for running php code as multi-process daemon.
We just need only one script file and one config file. The php script file defines the callback functions. The ini config file defines daemon's enviroments. You can use this command to start you daemon:
php src/Stark/run.php -f [ini_config_file]
An example configuration ini file:
[main]name = "config_1"host = "127.0.0.1"port = 9003working_dir = "/tmp"[run]script_file = "run_1.php"memory_limit = "1024M"[worker]count = 3max_run_count = 10000max_run_seconds = 3600max_idle_seconds = 60
<?php$g_count = 0;function run($worker, $data) { global $g_count; $g_count++; echo "Worker {$worker->index} current: {$g_count}\r\n"; usleep(100000);}项目主页:http://www.open-open.com/lib/view/home/1436863173271
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号