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

Openswoole\Table is not using the conflictProportion parameter #362

Open
marco-exads opened this issue Aug 12, 2024 · 0 comments
Open

Openswoole\Table is not using the conflictProportion parameter #362

marco-exads opened this issue Aug 12, 2024 · 0 comments

Comments

@marco-exads
Copy link

1. What did you do? If possible, provide a simple script for reproducing the error.
I've set the Table conflictProportion from the default 1 to 0.2, to reduce memory usage

use OpenSwoole\Table;

$table = new Table(1024, 0.2);  // before was => $table = new Table(1024);
$table->column('id', Table::TYPE_INT, 8);
$table->column('name', Table::TYPE_STRING, 64);
$table->column('age', Table::TYPE_INT, 2);
$table->column('money', Table::TYPE_FLOAT);
$table->create();

echo "memory: " . $table->getMemorySize() . "\n";

2. What did you expect to see?
A memory usage reduction

3. What did you see instead?
Without the conflictProportion param: 401456 bytes
With the conflictProportion param set to 0.2: 401456 bytes

I think the problem is that when setting a value that is lower than 1, it's resetted here due to the SW_TABLE_CONFLICT_PROPORTION set to 1.
This make the parameter useless/ignored.

  1. What version of OpenSwoole are you using (show your php --ri openswoole)?
bash-5.1# php --ri openswoole

openswoole

Open Swoole => enabled
Author => Open Swoole Group <[email protected]>
Version => 22.1.2
Built => Dec 10 2023 21:17:14
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1w  11 Sep 2023
dtls => enabled
http2 => enabled
hook-curl => enabled
pcre => enabled
zlib => 1.2.12
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
postgresql => enabled

Directive => Local Value => Master Value
openswoole.enable_coroutine => On => On
openswoole.enable_preemptive_scheduler => Off => Off
openswoole.display_errors => On => On
openswoole.unixsock_buffer_size => 8388608 => 8388608
  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
bash-5.1# uname -a
Linux 404a64ea28ca 5.15.0-117-generic #127-Ubuntu SMP Fri Jul 5 20:13:28 UTC 2024 x86_64 Linux
bash-5.1# php -v
PHP 8.1.11 (cli) (built: Oct  6 2022 23:49:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.11, Copyright (c) Zend Technologies
bash-5.1# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-musl/11.2.1/lto-wrapper
Target: x86_64-alpine-linux-musl
Configured with: /home/buildozer/aports/main/gcc/src/gcc-11.2.1_git20220219/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl --target=x86_64-alpine-linux-musl --with-pkgversion='Alpine 11.2.1_git20220219' --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie --enable-default-ssp --enable-cloog-backend --enable-languages=c,c++,d,objc,go,fortran,ada,jit --disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer --enable-shared --enable-threads --enable-tls --enable-host-shared --with-system-zlib --with-linker-hash-style=gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.1 20220219 (Alpine 11.2.1_git20220219) 
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

No branches or pull requests

1 participant