Single process memory model for opcache in ZTS
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.1k
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 96
Mô tả
Description
In ZTS, all requests run inside the same process, so there's no need for coordination between different processes.
This means that a non-SHM memory model could be used, and a lock file could be replaced by a regular mutex.
This would be beneficial for applications that run exclusively in ZTS and create userland threads, such as PocketMine-MP. PocketMine already uses ZTS and opcache CLI in most places, but it's currently unable to assume opcode caching is always available due to some platforms restricting access to certain lockfile features and SHM, such as Android.
PocketMine has a lot of users who insist on running servers on their mobile devices for some reason, so they'd stand to benefit :)
Since classes and op_arrays in general are non-thread-safe by default, threading extensions benefit a ton from Opcache since Opcache makes op_arrays and many other structures thread-safe by design, so they don't need to be copied. However, because Opcache uses features that are restricted on some platforms - features which are not necessary when running in ZTS mode and creating user threads - the likes of ext-pmmpthread still have to copy-paste large amounts of code from zend_persist.c to provide this functionality if Opcache is not available. If Opcache had a non-SHM memory model that didn't require lockfiles, mmap or any other fancy stuff, this would allow my threading extension to assume Opcache will always be available and caching code, which would potentially allow me to delete an insane amount of code and massively reduce the maintenance burden of the extension.
I don't know if there might be some advantages for ZTS in general (perhaps lower overhead?) but this doesn't seem like a hard change in any case as far as I can understand, so I thought I'd float the suggestion.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách theo dõi hành vi hiện tại của Opcache đối với SHM, lockfile và mmap cùng với các đường dẫn ZTS của nó; issue không nêu tệp hoặc kiểm thử cụ thể nào. Công việc được xem là hoàn tất khi có một mô hình bộ nhớ ZTS không dùng SHM hoạt động được bằng các mutex thông thường, không có lockfile bị hạn chế hoặc các tính năng bộ nhớ dùng chung, đồng thời hành vi liên quan của nền tảng đã được xác minh.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- c, php
- Lĩnh vực
- backend, operating-systems
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100