# 協程內存開銷
新版本`4.0`使用了`C`棧+`PHP`棧的協程實現方案。`Server`程序每次請求的事件回調函數中會創建一個新協程,處理完成后協程退出。
在協程創建時需要創建一個全新的內存段作為`C`和`PHP`的棧,底層默認分配`2M(C)`虛擬內存+`8K(PHP)`內存(`PHP-7.2`或更高版本)。實際并不會分配這么內存,系統會根據在內存實際讀寫時發生缺頁中斷,再分配實際內存。
> 由于`PHP-7.1/7.0`未提供設置棧內存尺寸的接口,這些版本每個協程將申請`256K`的`PHP`內存
相比于異步回調程序,協程會增加一些內存管理的開銷。有一定性能損耗。經過壓測`QPS`依然可以達到較高的水平。
```shell
ab -c 100 -n 500000 -k http://127.0.0.1:9501/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 50000 requests
Completed 100000 requests
Completed 150000 requests
Completed 200000 requests
Completed 250000 requests
Completed 300000 requests
Completed 350000 requests
Completed 400000 requests
Completed 450000 requests
Completed 500000 requests
Finished 500000 requests
Server Software: swoole-http-server
Server Hostname: 127.0.0.1
Server Port: 9501
Document Path: /
Document Length: 24 bytes
Concurrency Level: 100
Time taken for tests: 3.528 seconds
Complete requests: 500000
Failed requests: 0
Keep-Alive requests: 500000
Total transferred: 132500000 bytes
HTML transferred: 12000000 bytes
Requests per second: 141738.54 [#/sec] (mean)
Time per request: 0.706 [ms] (mean)
Time per request: 0.007 [ms] (mean, across all concurrent requests)
Transfer rate: 36680.38 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 2
Processing: 0 1 0.9 0 7
Waiting: 0 1 0.9 0 7
Total: 0 1 0.9 0 7
WARNING: The median and mean for the processing time are not within a normal deviation
These results are probably not that reliable.
WARNING: The median and mean for the waiting time are not within a normal deviation
These results are probably not that reliable.
WARNING: The median and mean for the total time are not within a normal deviation
These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 2
80% 2
90% 2
95% 3
98% 3
99% 3
100% 7 (longest request)
```
- 第一章 入門指引
- 1.1 環境依賴
- 1.2 編譯安裝
- 1.2.1 編譯參數
- 1.2.2 常見錯誤
- 1.3 快速起步
- 1.3.1 創建TCP服務器
- 1.3.2 創建UDP服務器
- 1.3.3 創建Web服務器
- 1.3.4 創建WebSocket服務器
- 1.3.5 設置定時器
- 1.3.6 執行異步任務
- 1.3.7 創建同步TCP客戶端
- 1.3.8 創建異步TCP客戶端
- 1.3.9 網絡通信協議設計
- 1.3.10 使用異步客戶端
- 1.3.11 多進程共享數據
- 1.4 編程須知
- 1.4.1 sleep/usleep的影響
- 1.4.2 exit/die函數的影響
- 1.4.3 while循環的影響
- 1.4.4 stat緩存清理
- 1.4.5 mt_rand隨機數
- 1.5 版本更新記錄
- 1.5.1 4.2.2
- 1.5.2 4.2.1
- 1.5.3 4.2.0
- 1.5.4 4.1.2
- 1.5.5 4.1.1
- 1.5.6 4.1.0
- 1.5.7 4.0.4
- 1.5.8 4.0.3
- 1.5.9 4.0.2
- 1.5.10 4.0.1
- 1.5.11 4.0.0
- 1.6 向下不兼容改動
- 1.7 新特性使用
- 1.7.1 2.1.2 進程池模塊的使用
- 1.7.2 1.9.24 調度支持 Stream 模式
- 1.7.3 1.9.24 異步客戶端自動解析域名
- 1.7.4 1.9.17 支持異步安全重啟特性
- 1.7.5 1.9.14 使用異步客戶端超時機制
- 1.7.6 1.8.0 使用內置Http異步客戶端
- 1.7.7 1.7.16 使用迭代器遍歷Server所有連接
- 1.7.8 1.7.5 在Server中使用swoole_table
- 1.7.9 1.7.5 swoole_client支持sendfile接口
- 1.7.10 1.7.4 SSL隧道加密TCP-Server
- 1.7.11 1.7.4 task進程中使用毫秒定時器
- 1.7.12 1.7.3 固定包頭+包體協議自動分包
- 1.7.13 1.7.3 onTask直接return取代finish函數
- 1.7.14 1.7.2 swoole_process多進程模塊的使用
- 1.7.15 1.7.2 task進程使用消息隊列
- 1.8 項目路線圖
- 1.9 php.ini選項
- 1.10 內核參數調整
- 1.12 衍生開源項目
- 1.12.1 框架
- 1.12.2 工具
- 1.12.3 分布式
- 1.12.4 通信協議
- 1.13 用戶與案例
- 1.13.1 物聯網項目
- 1.13.2 網絡游戲
- 1.13.3 騰訊(Tencent)
- 1.13.4 百度(Baidu.com)
- 1.13.5 閱文集團
- 1.13.6 BiliBili(嗶哩嗶哩)
- 1.13.7 車輪互聯(chelun.com)
- 1.13.8 (撈月狗) 游戲社區
- 1.14 提交錯誤報告
- 1.15 常見問題
- 1.15.1 升級swoole版本的常見問題
- 1.15.2 生成可分發的二進制swoole版本
- 1.15.3 在phpinfo中有在php -m中沒有
- 1.15.4 Connection refused是怎么回事
- 1.15.5 Resource temporarily unavailable [11]
- 1.15.6 Cannot assign requested address [99]
- 1.15.7 swoole與node.js相比有哪些優勢
- 1.15.8 swoole與golang相比有哪些優勢
- 1.15.9 pcre.h: No such file or directory
- 1.15.10 my_global.h: No such file or directory
- 1.15.11 undefined symbol: __sync_bool_compare_and_swap_4
- 1.15.12 學習Swoole需要掌握哪些基礎知識
- 1.15.13 同步阻塞與異步非阻塞適用場景
- 1.15.14 PHP7環境下出現zend_mm_heap corrupted
- 1.15.15 swoole項目起源和名字由來
- 1.15.16 swFactoryProcess_finish (ERROR 1004): send %d byte failed, because session#%d is closed / swFactoryProcess_finish (ERROR 1005): connection[fd=%d] does not exists
- 第二章 Server
- 2.1 函數列表
- 2.1.1 swoole_server::__construct
- 2.1.2 swoole_server->set
- 2.1.3 swoole_server->on
- 2.1.4 swoole_server->addListener
- 2.1.5 swoole_server->addProcess
- 2.1.6 swoole_server->listen
- 2.1.7 swoole_server->start
- 2.1.8 swoole_server->reload
- 2.1.9 swoole_server->stop
- 2.1.10 swoole_server->shutdown
- 2.1.11 swoole_server->tick
- 2.1.12 swoole_server->after
- 2.1.13 swoole_server->defer
- 2.1.14 swoole_server->clearTimer
- 2.1.15 swoole_server->close
- 2.1.16 swoole_server->send
- 2.1.17 swoole_server->sendfile
- 2.1.18 swoole_server->sendto
- 2.1.19 swoole_server->sendwait
- 2.1.20 swoole_server->sendMessage
- 2.1.21 swoole_server->exist
- 2.1.22 swoole_server->pause
- 2.1.23 swoole_server->resume
- 2.1.24 swoole_server->getClientInfo
- 2.1.25 swoole_server->getClientList
- 2.1.26 swoole_server->bind
- 2.1.27 swoole_server->stats
- 2.1.28 swoole_server->task
- 2.1.29 swoole_server->taskwait
- 2.1.30 swoole_server->taskWaitMulti
- 2.1.31 swoole_server->taskCo
- 2.1.32 swoole_server->finish
- 2.1.33 swoole_server->heartbeat
- 2.1.34 swoole_server->getLastError
- 2.1.35 swoole_server->getSocket
- 2.1.36 swoole_server->protect
- 2.1.37 swoole_server->confirm
- 2.2 屬性列表
- 2.2.1 swoole_server::$setting
- 2.2.2 swoole_server::$master_pid
- 2.2.3 swoole_server::$manager_pid
- 2.2.4 swoole_server::$worker_id
- 2.2.5 swoole_server::$worker_pid
- 2.2.6 swoole_server::$taskworker
- 2.2.7 swoole_server::$connections
- 2.2.8 swoole_server::$ports
- 2.3 配置選項
- 2.3.1 reactor_num
- 2.3.2 worker_num
- 2.3.3 max_request
- 2.3.4 max_conn (max_connection)
- 2.3.5 task_worker_num
- 2.3.6 task_ipc_mode
- 2.3.7 task_max_request
- 2.3.8 task_tmpdir
- 2.3.9 dispatch_mode
- 2.3.10 dispatch_func
- 2.3.11 message_queue_key
- 2.3.12 daemonize
- 2.3.13 backlog
- 2.3.14 log_file
- 2.3.15 log_level
- 2.3.16 heartbeat_check_interval
- 2.3.17 heartbeat_idle_time
- 2.3.18 open_eof_check
- 2.3.19 open_eof_split
- 2.3.20 package_eof
- 2.3.21 open_length_check
- 2.3.22 package_length_type
- 2.3.23 package_length_func
- 2.3.24 package_max_length
- 2.3.25 open_cpu_affinity
- 2.3.26 cpu_affinity_ignore
- 2.3.27 open_tcp_nodelay
- 2.3.28 tcp_defer_accept
- 2.3.29 ssl_cert_file
- 2.3.30 ssl_method
- 2.3.31 ssl_ciphers
- 2.3.32 user
- 2.3.33 group
- 2.3.34 chroot
- 2.3.35 pid_file
- 2.3.36 pipe_buffer_size
- 2.3.37 buffer_output_size
- 2.3.38 socket_buffer_size
- 2.3.39 enable_unsafe_event
- 2.3.40 discard_timeout_request
- 2.3.41 enable_reuse_port
- 2.3.42 enable_delay_receive
- 2.3.43 open_http_protocol
- 2.3.44 open_http2_protocol
- 2.3.45 open_websocket_protocol
- 2.3.46 open_mqtt_protocol
- 2.3.47 open_websocket_close_frame
- 2.3.48 reload_async
- 2.3.49 tcp_fastopen
- 2.3.50 request_slowlog_file
- 2.3.51 enable_coroutine
- 2.3.52 max_coroutine
- 2.4 監聽端口
- 2.4.1 可選參數
- 2.4.2 可選回調
- 2.4.3 連接迭代器
- 2.5 預定義常量
- 2.6 事件回調函數
- 2.6.1 onStart
- 2.6.2 onShutdown
- 2.6.3 onWorkerStart
- 2.6.4 onWorkerStop
- 2.6.5 onWorkerExit
- 2.6.6 onConnect
- 2.6.7 onReceive
- 2.6.8 onPacket
- 2.6.9 onClose
- 2.6.10 onBufferFull
- 2.6.11 onBufferEmpty
- 2.6.12 onTask
- 2.6.13 onFinish
- 2.6.14 onPipeMessage
- 2.6.15 onWorkerError
- 2.6.16 onManagerStart
- 2.6.17 onManagerStop
- 2.7 高級特性
- 2.7.1 改變Worker進程的用戶/組
- 2.7.2 回調函數中的 reactor_id 和 fd
- 2.7.3 Length_Check 和 EOF_Check 的使用
- 2.7.4 Worker與Reactor通信模式
- 2.7.5 TCP-Keepalive死連接檢測
- 2.7.6 TCP服務器心跳維持方案
- 2.7.7 多端口監聽的使用
- 2.7.8 捕獲Server運行期致命錯誤
- 2.7.9 swoole_server的兩種運行模式介紹
- 2.7.10 swoole_server中對象的4層生命周期
- 2.7.11 在worker進程內監聽一個Server端口
- 2.7.12 在php-fpm/apache中使用task功能
- 2.8 常見問題
- 2.8.1 為什么不要send完后立即close
- 2.8.2 如何在回調函數中訪問外部的變量
- 2.8.3 swoole_server中內存管理機制
- 2.8.4 是否可以共用1個redis或mysql連接
- 2.8.5 關于onConnect/onReceive/onClose順序
- 2.8.6 4種PHP回調函數風格
- 2.8.7 不同的Server程序實例間如何通信
- 2.8.8 錯誤信息:ERROR (9006)
- 2.8.9 eventLoop has already been created. unable to create swoole_server
- 2.9 壓力測試
- 2.9.1 并發10萬TCP連接的測試
- 2.9.2 PHP7+Swoole/Nginx/Golang性能對比
- 2.9.3 全球Web框架權威性能測試 Techempower Web Framework Benchmarks
- 第三章 Client
- 3.1 方法列表
- 3.1.1 swoole_client::__construct
- 3.1.2 swoole_client->set
- 3.1.3 swoole_client->on
- 3.1.4 swoole_client->connect
- 3.1.5 swoole_client->isConnected
- 3.1.6 swoole_client->getSocket
- 3.1.7 swoole_client->getSockName
- 3.1.8 swoole_client->getPeerName
- 3.1.9 swoole_client->getPeerCert
- 3.1.10 swoole_client->send
- 3.1.11 swoole_client->sendto
- 3.1.12 swoole_client->sendfile
- 3.1.13 swoole_client->recv
- 3.1.14 swoole_client->close
- 3.1.15 swoole_client->sleep
- 3.1.16 swoole_client->wakeup
- 3.1.17 swoole_client->enableSSL
- 3.2 回調函數
- 3.2.1 onConnect
- 3.2.2 onError
- 3.3.3 onReceive
- 3.3.4 onClose
- 3.3.5 onBufferFull
- 3.3.6 onBufferEmpty
- 3.3 屬性列表
- 3.3.1 swoole_client->errCode
- 3.3.2 swoole_client->sock
- 3.3.3 swoole_client->reuse
- 3.4 并行
- 3.4.1 swoole_client_select
- 3.4.2 TCP客戶端異步連接
- 3.4.3 SWOOLE_KEEP建立TCP長連接
- 3.5 常量
- 3.6 配置選項
- 3.6.1 ssl_verify_peer
- 3.6.2 ssl_host_name
- 3.6.3 ssl_cafile
- 3.6.4 ssl_capath
- 3.6.5 package_length_func
- 3.7 常見問題
- 第四章 Coroutine
- 4.1 Coroutine
- 4.1.1 Coroutine::getuid
- 4.1.2 Coroutine::create
- 4.1.3 Coroutine::resume
- 4.1.4 Coroutine::suspend
- 4.1.5 Coroutine::fread
- 4.1.6 Coroutine::fgets
- 4.1.7 Coroutine::fwrite
- 4.1.8 Coroutine::sleep
- 4.1.9 Coroutine::gethostbyname
- 4.1.10 Coroutine::getaddrinfo
- 4.1.11 Coroutine::exec
- 4.1.12 Coroutine::readFile
- 4.1.13 Coroutine::writeFile
- 4.1.14 Coroutine::stats
- 4.1.15 Coroutine::getBackTrace
- 4.1.16 Coroutine::listCoroutines
- 4.2 Coroutine\Channel
- 4.2.1 Coroutine\Channel->__construct
- 4.2.2 Coroutine\Channel->push
- 4.2.3 Coroutine\Channel->pop
- 4.2.4 Coroutine\Channel->stats
- 4.2.5 Coroutine\Channel->close
- 4.2.6 Coroutine\Channel->length
- 4.2.7 Coroutine\Channel->isEmpty
- 4.2.8 Coroutine\Channel->isFull
- 4.2.9 Coroutine\Channel->$capacity
- 4.2.10 Coroutine\Channel->$errCode
- 4.3 Coroutine\Client
- 4.3.1 Coroutine\Client->connect
- 4.3.2 Coroutine\Client->send
- 4.3.3 Coroutine\Client->recv
- 4.3.4 Coroutine\Client->close
- 4.3.5 Coroutine\Client->peek
- 4.4 Coroutine\Http\Client
- 4.4.1 屬性列表
- 4.4.2 Coroutine\Http\Client->get
- 4.4.3 Coroutine\Http\Client->post
- 4.4.4 Coroutine\Http\Client->upgrade
- 4.4.5 Coroutine\Http\Client->push
- 4.4.6 Coroutine\Http\Client->recv
- 4.4.7 Coroutine\Http\Client->addFile
- 4.4.8 Coroutine\Http\Client->addData
- 4.4.9 Coroutine\Http\Client->download
- 4.5 Coroutine\Http2\Client
- 4.5.1 Coroutine\Http2\Client->__construct
- 4.5.2 Coroutine\Http2\Client->set
- 4.5.3 Coroutine\Http2\Client->connect
- 4.5.4 Coroutine\Http2\Client->send
- 4.5.5 Coroutine\Http2\Client->write
- 4.5.6 Coroutine\Http2\Client->recv
- 4.5.7 Coroutine\Http2\Client->close
- 4.6 Coroutine\Redis
- 4.6.1 方法列表
- 4.6.2 屬性列表
- 4.7 Coroutine\Socket
- 4.7.1 Coroutine\Socket::__construct
- 4.7.2 Coroutine\Socket->bind
- 4.7.3 Coroutine\Socket->listen
- 4.7.4 Coroutine\Socket->accept
- 4.7.5 Coroutine\Socket->connect
- 4.7.6 Coroutine\Socket->send
- 4.7.7 Coroutine\Socket->recv
- 4.7.8 Coroutine\Socket->sendto
- 4.7.9 Coroutine\Socket->recvfrom
- 4.7.10 Coroutine\Socket->getsockname
- 4.7.11 Coroutine\Socket->getpeername
- 4.7.12 Coroutine\Socket->close
- 4.8 Coroutine\MySQL
- 4.8.1 屬性列表
- 4.8.2 Coroutine\MySQL->connect
- 4.8.3 Coroutine\MySQL->query
- 4.8.4 Coroutine\MySQL->prepare
- 4.8.5 Coroutine\MySQL\Statement->execute
- 4.8.6 Coroutine\MySQL\Statement->fetch
- 4.8.7 Coroutine\MySQL\Statement->fetchAll
- 4.8.8 Coroutine\MySQL\Statement->nextResult
- 4.8.9 Coroutine\MySQL->execFile
- 4.9 Coroutine\PostgreSQL
- 4.9.1 Coroutine\PostgreSQL->connect
- 4.9.2 Coroutine\PostgreSQL->query
- 4.9.3 Coroutine\PostgreSQL->fetchAll
- 4.9.4 Coroutine\PostgreSQL->affectedRows
- 4.9.5 Coroutine\PostgreSQL->numRows
- 4.9.6 Coroutine\PostgreSQL->fetchObject
- 4.9.7 Coroutine\PostgreSQL->fetchAssoc
- 4.9.8 Coroutine\PostgreSQL->fetchArray
- 4.9.9 Coroutine\PostgreSQL->fetchRow
- 4.9.10 Coroutine\PostgreSQL->metaData
- 4.10 Runtime::enableCoroutine
- 4.10.1 文件操作
- 4.10.2 睡眠函數
- 4.10.3 開關選項
- 4.11 Server
- 4.12 并發調用
- 4.12.1 Defer 機制
- 4.12.2 子協程+通道
- 4.13 實現原理
- 4.13.1 協程與線程
- 4.13.2 發送數據協程調度
- 4.13.3 協程內存開銷
- 4.13.4 4.0 協程實現原理
- 4.14 常見問題
- 4.14.1 運行中出現 Fatal error: Maximum function nesting level of '1000' reached, aborting!
- 4.14.2 為什么只能在回調函數中使用協程客戶端
- 4.14.3 支持協程的回調方法列表
- 4.14.4 錯誤信息: XXXX client has already been bound to another coroutine
- 4.14.5 Swoole4 協程與 PHP 的 Yield/Generator 協程有什么區別
- 4.15 編程須知
- 4.15.1 在多個協程間共用同一個協程客戶端
- 4.15.2 禁止使用協程 API 的場景 (Swoole4以下版本)
- 4.15.3 使用類靜態變量/全局變量保存上下文
- 4.16 退出協程
- 4.17 擴展組件
- 4.17.1 MongoDB
- 第五章 Async
- 5.1 異步文件系統IO
- 5.1.1 swoole_async_readfile
- 5.1.2 swoole_async_writefile
- 5.1.3 swoole_async_read
- 5.1.4 swoole_async_write
- 5.1.5 swoole_async_dns_lookup
- 5.1.6 swoole_async::exec
- 5.2 EventLoop
- 5.2.1 swoole_event_add
- 5.2.2 swoole_event_set
- 5.2.3 swoole_event_isset
- 5.2.4 swoole_event_write
- 5.2.5 swoole_event_del
- 5.2.6 swoole_event_exit
- 5.2.7 swoole_event_defer
- 5.2.8 swoole_event_cycle
- 5.2.9 swoole_event_wait
- 5.2.10 swoole_event_dispatch
- 5.3 異步毫秒定時器
- 5.3.1 swoole_timer_tick
- 5.3.2 swoole_timer_after
- 5.3.3 swoole_timer_clear
- 5.4 異步MySQL客戶端
- 5.4.1 swoole_mysql->__construct
- 5.4.2 swoole_mysql->on
- 5.4.3 swoole_mysql->connect
- 5.4.4 swoole_mysql->escape
- 5.4.5 swoole_mysql->query
- 5.4.6 swoole_mysql->begin
- 5.4.7 swoole_mysql->commit
- 5.4.8 swoole_mysql->rollback
- 5.4.9 swoole_mysql->close
- 5.5 異步Redis客戶端
- 5.5.1 swoole_redis->__construct
- 5.5.2 swoole_redis->on
- 5.5.3 swoole_redis->connect
- 5.5.4 swoole_redis->__call
- 5.5.5 swoole_redis->close
- 5.6 異步Http/WebSocket客戶端
- 5.6.1 swoole_http_client->__construct
- 5.6.2 swoole_http_client->set
- 5.6.3 swoole_http_client->setMethod
- 5.6.4 swoole_http_client->setHeaders
- 5.6.5 swoole_http_client->setCookies
- 5.6.6 swoole_http_client->setData
- 5.6.7 swoole_http_client->addFile
- 5.6.8 swoole_http_client->get
- 5.6.9 swoole_http_client->post
- 5.6.10 swoole_http_client->upgrade
- 5.6.11 swoole_http_client->push
- 5.6.12 swoole_http_client->execute
- 5.6.13 swoole_http_client->download
- 5.6.14 swoole_http_client->close
- 5.7 異步Http2.0客戶端
- 5.7.1 swoole_http2_client->__construct
- 5.7.2 swoole_http2_client->get
- 5.7.3 swoole_http2_client->post
- 5.7.4 swoole_http2_client->setHeaders
- 5.7.5 swoole_http2_client->setCookies
- 第六章 Memory
- 6.1 Lock
- 6.1.1 swoole_lock->__construct
- 6.1.2 swoole_lock->lock
- 6.1.3 swoole_lock->trylock
- 6.1.4 swoole_lock->unlock
- 6.1.5 swoole_lock->lock_read
- 6.1.6 swoole_lock->trylock_read
- 6.1.7 swoole_lock->lockwait
- 6.2 Buffer
- 6.2.1 swoole_buffer->__construct
- 6.2.2 swoole_buffer->append
- 6.2.3 swoole_buffer->substr
- 6.2.4 swoole_buffer->clear
- 6.2.5 swoole_buffer->expand
- 6.2.6 swoole_buffer->write
- 6.2.7 swoole_buffer->read
- 6.2.8 swoole_buffer->recycle
- 6.3 Table
- 6.3.1 swoole_table->__construct
- 6.3.2 swoole_table->column
- 6.3.3 swoole_table->create
- 6.3.4 swoole_table->set
- 6.3.5 swoole_table->incr
- 6.3.6 swoole_table->decr
- 6.3.7 swoole_table->get
- 6.3.8 swoole_table->exist
- 6.3.9 swoole_table->del
- 6.3.10 常量列表
- 6.3.11 swoole_table->count
- 6.4 Atomic
- 6.4.1 swoole_atomic->__construct
- 6.4.2 swoole_atomic->add
- 6.4.3 swoole_atomic->sub
- 6.4.4 swoole_atomic->get
- 6.4.5 swoole_atomic->set
- 6.4.6 swoole_atomic->cmpset
- 6.4.7 swoole_atomic->wait
- 6.4.8 swoole_atomic->wakeup
- 6.5 mmap
- 6.5.1 swoole_mmap::open
- 6.6 Channel
- 6.6.1 Channel->__construct
- 6.6.2 Channel->push
- 6.6.3 Channel->pop
- 6.6.4 Channel->stats
- 6.7 Serialize
- 6.7.1 swoole_serialize::pack
- 6.7.2 swoole_serialize::unpack
- 第七章 Process
- 7.1 swoole_process::__construct
- 7.2 swoole_process->start
- 7.3 swoole_process->name
- 7.4 swoole_process->exec
- 7.5 swoole_process->write
- 7.6 swoole_process->read
- 7.7 swoole_process->setTimeout
- 7.8 swoole_process->setBlocking
- 7.9 swoole_process->useQueue
- 7.10 swoole_process->statQueue
- 7.11 swoole_process->freeQueue
- 7.12 swoole_process->push
- 7.13 swoole_process->pop
- 7.14 swoole_process->close
- 7.15 swoole_process->exit
- 7.16 swoole_process::kill
- 7.17 swoole_process::wait
- 7.18 swoole_process::daemon
- 7.19 swoole_process::signal
- 7.20 swoole_process::alarm
- 7.21 swoole_process::setAffinity
- 第八章 HttpServer
- 8.1 swoole_http_server
- 8.1.1 swoole_http_server->on
- 8.1.2 swoole_http_server->start
- 8.2 swoole_http_request
- 8.2.1 swoole_http_request->$header
- 8.2.2 swoole_http_request->$server
- 8.2.3 swoole_http_request->$get
- 8.2.4 swoole_http_request->$post
- 8.2.5 swoole_http_request->$cookie
- 8.2.6 swoole_http_request->$files
- 8.2.7 swoole_http_request->rawContent
- 8.2.8 swoole_http_request->getData
- 8.3 swoole_http_response
- 8.3.1 swoole_http_response->header
- 8.3.2 swoole_http_response->cookie
- 8.3.3 swoole_http_response->status
- 8.3.4 swoole_http_response->gzip
- 8.3.5 swoole_http_response->redirect
- 8.3.6 swoole_http_response->write
- 8.3.7 swoole_http_response->sendfile
- 8.3.8 swoole_http_response->end
- 8.3.9 swoole_http_response->detach
- 8.3.10 swoole_http_response::create
- 8.4 配置選項
- 8.4.1 upload_tmp_dir
- 8.4.2 http_parse_post
- 8.4.3 document_root
- 8.4.4 http_compression
- 8.5 常見問題
- 8.5.1 CURL發送POST請求服務器端超時
- 8.5.2 使用Chrome訪問服務器會產生2次請求
- 8.5.3 GET/POST請求的最大尺寸
- 第九章 WebSocket
- 9.1 回調函數
- 9.1.1 onHandShake
- 9.1.2 onOpen
- 9.1.3 onMessage
- 9.2 函數列表
- 9.2.1 swoole_websocket_server->push
- 9.2.2 swoole_websocket_server->exist
- 9.2.3 swoole_websocket_server::pack
- 9.2.4 swoole_websocket_server::unpack
- 9.2.5 swoole_websocket_server->disconnect
- 9.3 預定義常量
- 9.4 常見問題
- 9.5 配置選項
- 9.6 swoole_websocket_frame
- 第十章 Process\Pool
- 10.1 Process\Pool::__construct
- 10.2 Process\Pool->on
- 10.3 Process\Pool->listen
- 10.4 Process\Pool->write
- 10.5 Process\Pool->start
- 10.6 Process\Pool->getProcess
- 第十一章 Redis\Server
- 11.1 方法
- 11.1.1 setHandler
- 11.1.2 format
- 11.2 常量
- 第十二章 高級
- 12.1 Swoole的實現
- 12.2 Reactor線程
- 12.3 Manager進程
- 12.4 Worker進程
- 12.5 Reactor、Worker、TaskWorker的關系
- 12.6 Task/Finish特性的用途
- 12.7 在php-fpm或apache中使用swoole
- 12.8 Swoole異步與同步的選擇
- 12.9 TCP/UDP壓測工具
- 12.10 swoole服務器如何做到無人值守100%可用
- 12.11 MySQL的連接池、異步、斷線重連
- 12.12 PHP中哪些函數是同步阻塞的
- 12.13 守護進程程序常用數據結構
- 12.13.1 隊列(Queue)
- 12.13.2 堆(Heap)
- 12.13.3 定長數組(SplFixedArray)
- 12.14 使用jemalloc優化swoole內存分配性能
- 12.15 C開發者如何使用Swoole
- 12.16 C++開發者如何使用Swoole
- 12.17 使用systemd管理swoole服務
- 12.18 網卡中斷設置
- 12.19 將Swoole靜態編譯內嵌到PHP
- 12.20 異步回調程序內存管理
- 12.21 日志等級控制
- 12.22 使用 asan 內存檢測
- 12.23 Windows編譯
- 第十三章 其他
- 13.1 函數列表
- 13.1.1 swoole_set_process_name
- 13.1.2 swoole_version
- 13.1.3 swoole_strerror
- 13.1.4 swoole_errno
- 13.1.5 swoole_get_local_ip
- 13.1.6 swoole_clear_dns_cache
- 13.1.7 swoole_get_local_mac
- 13.1.8 swoole_cpu_num
- 13.3 Swoole技術會議
- 13.4 捐贈Swoole項目
- 13.5 加入Swoole開發組
- 13.6 附錄:Linux信號列表
- 13.7 附錄:Linux錯誤信息(errno)列表
- 13.8 附錄:TCP連接的狀態
- 13.9 附錄:tcpdump抓包工具的使用
- 13.10 附錄:strace工具的使用
- 13.11 附錄:gdb工具的使用
- 13.12 附錄:lsof工具的使用
- 13.13 附錄:perf工具的使用
- 13.14 附錄:編譯PHP擴展的相關工具
- 13.15 備用:已移除的歷史特性
- 13.15.1 swoole_server->handler
- 13.15.2 task_worker_max
- 13.15.3 swoole_server->addtimer
- 13.15.4 swoole_server->deltimer
- 13.15.5 onTimer
- 13.15.6 swoole_timer_add
- 13.15.7 swoole_timer_del
- 13.15.8 swoole_get_mysqli_sock
- 13.15.9 swoole_mysql_query
- 13.15.10 onMasterConnect
- 13.15.11 onMasterClose
- 13.15.12 Nginx/Golang/Swoole/Node.js的性能對比
- 13.15.13 Coroutine::call_user_func
- 13.15.14 Coroutine::call_user_func_array
- 13.15.15 Coroutine\Channel::select
- 13.16 歷史:版本更新記錄(1.x)
- 13.16.1 1.10.3
- 13.16.2 1.10.2
- 13.16.3 1.10.1
- 13.16.4 1.10.0
- 13.16.5 1.9.23
- 13.16.6 1.9.22
- 13.16.7 1.9.19
- 13.16.8 1.9.18
- 13.16.9 1.9.17
- 13.16.10 1.9.16
- 13.16.11 1.9.15
- 13.16.12 1.9.14
- 13.16.13 1.9.12
- 13.16.14 1.9.11
- 13.16.15 1.9.9
- 13.16.16 1.9.7
- 13.16.17 1.9.6
- 13.16.18 1.9.5
- 13.16.19 1.9.4
- 13.16.20 1.9.3
- 13.16.21 1.9.2
- 13.16.22 1.9.1
- 13.16.23 1.9.0
- 13.16.24 1.8.13
- 13.16.25 1.8.12
- 13.16.26 1.8.11
- 13.16.27 1.8.10
- 13.16.28 1.8.9
- 13.16.29 1.8.8
- 13.16.30 1.8.7
- 13.16.31 1.8.6
- 13.16.32 1.8.5
- 13.16.33 1.8.4
- 13.16.34 1.8.3
- 13.16.35 1.8.2
- 13.16.36 1.8.1
- 13.16.37 1.8.0
- 13.16.38 1.7.22
- 13.16.39 1.7.21
- 13.16.40 1.7.20
- 13.16.41 1.7.19
- 13.16.42 1.7.18
- 13.16.43 1.7.17
- 13.16.44 1.7.16
- 13.16.45 1.7.15
- 13.16.46 1.7.14
- 13.16.47 1.7.13
- 13.16.48 1.7.12
- 13.16.49 1.7.11
- 13.16.50 1.7.10
- 13.16.51 1.7.9
- 13.16.52 1.7.8
- 13.16.53 1.7.7
- 13.16.54 1.7.6
- 13.16.55 1.7.5
- 13.16.56 v1.5
- 13.16.57 v1.6
- 13.16.58 v1.7
- 13.17 歷史:版本更新記錄(2.x)
- 13.17.1 2.0.1-Alpha
- 13.17.2 2.0.5
- 13.17.3 2.0.9
- 13.17.4 1.9.21
- 13.17.5 2.0.10
- 13.17.6 2.0.11
- 13.17.7 2.0.12
- 13.17.8 2.0.13
- 13.17.9 2.1.1
- 13.17.10 2.1.2
- 13.17.11 2.2.0
- 13.17.12 3.0.0
- 13.20 參與開源項目指引