기본 이벤트 처리 함수 stream_select()는 1024개 한계가 있음

https://www.php.net/manual/en/function.stream-select.php

    이 한계를 풀고 성능을 향상시키기 위해 별도의 이벤트 라이브러리들이 존재

 

//

php event library

https://pecl.php.net/packages.php?catpid=44&catname=Event

1024 개의 동시 연결 제한이없는 다른 이벤트 루프를 사용하기 


//참고
https://github.com/reactphp/event-loop#loop-implementations

signal handling - ext-pcntl


//=======================================
libev
a high performance full-featured event loop written in C
http://software.schmorp.de/pkg/libev.html

http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod

https://github.com/enki/libev - 754
- 3년전, release 없음
- 문서 부족


* php - ev
pecl-ev
PECL extension providing interface to libev library

ev is a PECL extension providing interface to libev library - high performance full-featured event loop written in C.

Libev is an event loop

https://pecl.php.net/package/ev/
v1.0.6 stable 2019-05-25

https://bitbucket.org/osmanov/pecl-ev

php Process Control Extensions
http://docs.php.net/ev


//===========
Libev 

//==========
* 설치
sudo pecl channel-update pecl.php.net
sudo pecl install ev

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading ev-1.0.6.tgz ...

Starting to download ev-1.0.6.tgz (125,014 bytes)
............................done: 125,014 bytes
86 source files, building


You should add "extension=ev.so" to php.ini


php.ini 파일 수정
extension=ev.so   <== 추가





//============================================
libevent

https://github.com/libevent/libevent - 5,044
- v2.1.11 , 2019/08

https://libevent.org/
https://www.php.net/manual/en/book.libevent.php



//========
https://juejin.im/entry/5b39661be51d4558ae19fd03

* PHP5 installation:
pecl install libevent-0.1.0
 

* PHP7 installation (unstable):
git clone https://github.com/expressif/pecl-event-libevent.git
cd pecl-event-libevent
phpize
./configure
make && sudo make install


//=================
* php - event

Event - PECL extension
Event is a PECL extension providing interface to libevent C library.
Provides interface to libevent library

https://pecl.php.net/package/event
v2.5.3 stable 2019-06-16

https://bitbucket.org/osmanov/pecl-event

php Other Services
http://docs.php.net/event


* 설치
sudo pecl channel-update pecl.php.net
sudo pecl install event

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading event-2.5.3.tgz ...
Starting to download event-2.5.3.tgz (140,913 bytes)
..............................done: 140,913 bytes
50 source files, building


You should add "extension=event.so" to php.ini

- php.ini 파일 수정
extension=ev.so   <== 추가





//================================================

libuv 

libuv/libuv
비동기 I/O 용 C 라이브러리
node.js 에서 사용


https://github.com/libuv/libuv - 13,170
- v1.30.1 ,  2019.07

https://libuv.org/



//===============
* PHP -  libuv wrapper
https://pecl.php.net/package/uv
0.2.4 beta 2019-05-01


* 설치
sudo pecl install uv-beta


checking for libuv... checking for uv_version in -luv... no
configure: error: wrong uv library version or library not found
ERROR: `/tmp/pear/temp/uv/configure --with-php-config=/usr/bin/php-config' failed


//==========
// 참고
* php에서 uv 활용
https://github.com/bwoebi/php-uv - 117
- v0.2.2 , 2017/06


* 설치
git clone https://github.com/bwoebi/php-uv.git
cd php-uv
phpize
./configure
make
make install
# add `extension=uv.so` to your php.ini


checking for libuv  checking for uv_version in luv  no
configure: error: wrong uv library version or library not found




//=====================================
ReactPhp
reactphp/react
Event-driven, non-blocking I/O with PHP

https://github.com/reactphp/react - 7000
- v1.0.0 , 2019/07

https://reactphp.org/


* 설치
composer require react/react:^1.0


반응형
Posted by codens