Skip to content

Commit 7ccad70

Browse files
authored
[php] Enable jit for workerman and webman (#9258)
* Enable jit and remove unnecessary files * Remove reusePort * Add maintainers walkor * Use the latest event extension * Use event-3.1.4 * Add without jit tests * Fix dockerfile name * Add space to display_name * save * Reuseport
1 parent 540de89 commit 7ccad70

17 files changed

+194
-142
lines changed

frameworks/PHP/webman/benchmark_config.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
{
22
"framework": "webman",
3+
"maintainers": ["walkor"],
34
"tests": [{
45
"default": {
6+
"dockerfile": "webman.dockerfile",
57
"json_url": "/json",
68
"plaintext_url": "/plaintext",
9+
"port": 8080,
10+
"approach": "Realistic",
11+
"classification": "Micro",
12+
"database": "Postgres",
13+
"framework": "webman",
14+
"language": "PHP",
15+
"flavor": "PHP7",
16+
"orm": "Raw",
17+
"platform": "workerman",
18+
"webserver": "None",
19+
"os": "Linux",
20+
"database_os": "Linux",
21+
"display_name": "webman",
22+
"notes": "",
23+
"versus": "workerman"
24+
},
25+
"pgsql": {
26+
"dockerfile": "webman-pgsql.dockerfile",
727
"db_url": "/db",
828
"query_url": "/queries/",
929
"update_url": "/updates/",
@@ -20,7 +40,7 @@
2040
"webserver": "None",
2141
"os": "Linux",
2242
"database_os": "Linux",
23-
"display_name": "webman",
43+
"display_name": "webman-pgsql",
2444
"notes": "",
2545
"versus": "workerman"
2646
}

frameworks/PHP/webman/config.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,21 @@ orm = "Raw"
1717
platform = "workerman"
1818
webserver = "None"
1919
versus = "workerman"
20+
21+
22+
[pgsql]
23+
urls.plaintext = "/plaintext"
24+
urls.json = "/json"
25+
urls.db = "/db"
26+
urls.query = "/queries/"
27+
urls.update = "/updates/"
28+
urls.fortune = "/fortunes"
29+
approach = "Realistic"
30+
classification = "Micro"
31+
database = "Postgres"
32+
database_os = "Linux"
33+
os = "Linux"
34+
orm = "Raw"
35+
platform = "workerman"
36+
webserver = "None"
37+
versus = "workerman"

frameworks/PHP/webman/config/server.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
'transport' => 'tcp',
1818
'context' => [],
1919
'name' => 'webman',
20-
'count' => cpu_count() * 4,
20+
'count' => cpu_count() * ( getenv('TEST_TYPE') === 'default' ? 1 : 4 ),
2121
'user' => '',
2222
'group' => '',
23+
'reuse_port' => true,
2324
'pid_file' => runtime_path() . '/webman.pid',
2425
'status_file' => runtime_path() . '/webman.status',
2526
'stdout_file' => runtime_path() . '/logs/stdout.log',

frameworks/PHP/webman/php.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1+
zend_extension=opcache.so
12
opcache.enable=1
23
opcache.enable_cli=1
34
opcache.validate_timestamps=0
45
opcache.save_comments=0
56
opcache.enable_file_override=1
67
opcache.huge_code_pages=1
7-
88
mysqlnd.collect_statistics = Off
9-
109
memory_limit = 512M
11-
1210
opcache.jit_buffer_size=128M
13-
opcache.jit=tracing
11+
opcache.jit=tracing
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM ubuntu:24.04
2+
3+
ENV TEST_TYPE pgsql
4+
5+
ARG DEBIAN_FRONTEND=noninteractive
6+
7+
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
8+
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
9+
apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null
10+
11+
RUN apt-get install -yqq php8.3-cli php8.3-pgsql php8.3-xml > /dev/null
12+
13+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
14+
15+
RUN apt-get update -yqq && apt-get install -y php-pear php8.3-dev libevent-dev git > /dev/null
16+
RUN pecl install event-3.1.4 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/30-event.ini
17+
18+
ADD ./ /webman
19+
WORKDIR /webman
20+
21+
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
22+
COPY php.ini /etc/php/8.3/cli/conf.d/10-opcache.ini
23+
24+
EXPOSE 8080
25+
26+
CMD php /webman/start.php start

frameworks/PHP/webman/webman.dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04
2+
3+
ENV TEST_TYPE default
24

35
ARG DEBIAN_FRONTEND=noninteractive
46

@@ -11,14 +13,13 @@ RUN apt-get install -yqq php8.3-cli php8.3-pgsql php8.3-xml > /dev/null
1113
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
1214

1315
RUN apt-get update -yqq && apt-get install -y php-pear php8.3-dev libevent-dev git > /dev/null
14-
RUN pecl install event-3.1.3 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/event.ini
15-
16-
COPY php.ini /etc/php/8.3/cli/php.ini
16+
RUN pecl install event-3.1.4 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/30-event.ini
1717

1818
ADD ./ /webman
1919
WORKDIR /webman
2020

2121
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
22+
COPY php.ini /etc/php/8.3/cli/conf.d/10-opcache.ini
2223

2324
EXPOSE 8080
2425

frameworks/PHP/workerman/benchmark_config.json

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
{
22
"framework": "workerman",
3+
"maintainers": ["walkor"],
34
"tests": [{
45
"default": {
6+
"dockerfile": "workerman-jit.dockerfile",
57
"json_url": "/json",
68
"plaintext_url": "/plaintext",
7-
"db_url": "/db",
8-
"query_url": "/query?q=",
9-
"update_url": "/update?q=",
10-
"fortune_url": "/fortunes",
119
"port": 8080,
1210
"approach": "Realistic",
1311
"classification": "Platform",
@@ -20,11 +18,12 @@
2018
"webserver": "None",
2119
"os": "Linux",
2220
"database_os": "Linux",
23-
"display_name": "workerman",
21+
"display_name": "workerman [jit]",
2422
"notes": "",
2523
"versus": "php"
2624
},
2725
"pgsql": {
26+
"dockerfile": "workerman-pgsql-jit.dockerfile",
2827
"db_url": "/db",
2928
"query_url": "/query?q=",
3029
"update_url": "/update?q=",
@@ -41,35 +40,54 @@
4140
"webserver": "None",
4241
"os": "Linux",
4342
"database_os": "Linux",
44-
"display_name": "workerman-postgres",
43+
"display_name": "workerman [jit, pgsql]",
4544
"notes": "",
4645
"versus": "php"
4746
},
48-
"async": {
47+
"mysql": {
48+
"dockerfile": "workerman-mysql-jit.dockerfile",
4949
"db_url": "/db",
50+
"query_url": "/query?q=",
51+
"update_url": "/update?q=",
5052
"fortune_url": "/fortunes",
5153
"port": 8080,
5254
"approach": "Realistic",
5355
"classification": "Platform",
5456
"database": "MySQL",
5557
"framework": "workerman",
5658
"language": "PHP",
57-
"flavor": "PHP7",
59+
"flavor": "PHP8",
5860
"orm": "Raw",
5961
"platform": "workerman",
6062
"webserver": "None",
6163
"os": "Linux",
6264
"database_os": "Linux",
63-
"display_name": "workerman-async-db",
65+
"display_name": "workerman [jit, mysql]",
6466
"notes": "",
65-
"versus": "php",
66-
"tags": [
67-
"broken"
68-
]
67+
"versus": "php"
6968
},
70-
"php8-jit": {
69+
"without-jit": {
70+
"dockerfile": "workerman.dockerfile",
7171
"json_url": "/json",
7272
"plaintext_url": "/plaintext",
73+
"port": 8080,
74+
"approach": "Realistic",
75+
"classification": "Platform",
76+
"database": "MySQL",
77+
"framework": "workerman",
78+
"language": "PHP",
79+
"flavor": "PHP8",
80+
"orm": "Raw",
81+
"platform": "workerman",
82+
"webserver": "None",
83+
"os": "Linux",
84+
"database_os": "Linux",
85+
"display_name": "workerman",
86+
"notes": "",
87+
"versus": "php"
88+
},
89+
"pgsql-without-jit": {
90+
"dockerfile": "workerman-pgsql.dockerfile",
7391
"db_url": "/db",
7492
"query_url": "/query?q=",
7593
"update_url": "/update?q=",
@@ -86,8 +104,8 @@
86104
"webserver": "None",
87105
"os": "Linux",
88106
"database_os": "Linux",
89-
"display_name": "workerman-php8-jit",
90-
"notes": "php8 jit",
107+
"display_name": "workerman [pgsql]",
108+
"notes": "",
91109
"versus": "php"
92110
}
93111
}]

frameworks/PHP/workerman/config.toml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ platform = "workerman"
3333
webserver = "None"
3434
versus = "php"
3535

36-
[php8-jit]
36+
[mysql]
3737
urls.plaintext = "/plaintext"
3838
urls.json = "/json"
3939
urls.db = "/db"
@@ -50,8 +50,12 @@ platform = "workerman"
5050
webserver = "None"
5151
versus = "php"
5252

53-
[async]
53+
[without-jit]
54+
urls.plaintext = "/plaintext"
55+
urls.json = "/json"
5456
urls.db = "/db"
57+
urls.query = "/query?q="
58+
urls.update = "/update?q="
5559
urls.fortune = "/fortunes"
5660
approach = "Realistic"
5761
classification = "Platform"
@@ -62,3 +66,20 @@ orm = "Raw"
6266
platform = "workerman"
6367
webserver = "None"
6468
versus = "php"
69+
70+
[pgsql-without-jit]
71+
urls.plaintext = "/plaintext"
72+
urls.json = "/json"
73+
urls.db = "/db"
74+
urls.query = "/query?q="
75+
urls.update = "/update?q="
76+
urls.fortune = "/fortunes"
77+
approach = "Realistic"
78+
classification = "Platform"
79+
database = "Postgres"
80+
database_os = "Linux"
81+
os = "Linux"
82+
orm = "Raw"
83+
platform = "workerman"
84+
webserver = "None"
85+
versus = "php"

frameworks/PHP/workerman/php-jit.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1+
zend_extension=opcache.so
12
opcache.enable=1
23
opcache.enable_cli=1
34
opcache.validate_timestamps=0
45
opcache.save_comments=0
56
opcache.enable_file_override=1
67
opcache.huge_code_pages=1
7-
88
mysqlnd.collect_statistics = Off
9-
109
memory_limit = 512M
11-
1210
opcache.jit_buffer_size=128M
13-
opcache.jit=tracing
11+
opcache.jit=tracing

frameworks/PHP/workerman/php.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ opcache.huge_code_pages=1
77

88
mysqlnd.collect_statistics = Off
99

10-
memory_limit = 512M
10+
memory_limit = 512M

0 commit comments

Comments
 (0)