Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Swoole in-memory table size #818

Merged
merged 2 commits into from
Jan 20, 2024

Conversation

miguilimzero
Copy link
Contributor

Octane considers that the Swoole table size parameter is the number of rows it can store. But this is not true; calculating the number of rows a table can store is hard as it contains the table header, key size, and conflict proportion. Their wiki page does not explain exactly how it works: https://wiki.swoole.com/#/memory/table?id=__construct.

The current Octane implementation is not working as expected. By trying to insert 1000 rows in the example table provided, which sets 1000 as the table size, Swoole was only able to store 596 rows.

This PR adds a test to check if octane can use all available table rows and sets the table conflict proportion to 1 to ensure that the table has allocated memory to at least the defined row counts.

The conflict proportion default value for the original Swoole is 0.2. OpenSwoole uses 1 as a default according to their documentation (https://openswoole.com/docs/modules/swoole-table-construct). So this issue is only happening on the original swoole. I added 1 as the conflict parameter to both to ensure both implementations use the same value.

@taylorotwell taylorotwell merged commit 83c2afb into laravel:2.x Jan 20, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants