Commit Graph

227 Commits

Author SHA1 Message Date
Rasmus Lerdorf
da71ae0362 Fix more tests with a slight refactor 2024-09-26 13:11:38 +02:00
Rasmus Lerdorf
198e9b3681 fix tests 2024-09-26 13:11:38 +02:00
Robert
e39a2e62f4 Add option to locally enforce payload size limit (#515)
Add a configuration option to enforce an item size limit on the client side. This avoids sending large items
over the wire and getting rejected by the server which can cause delays. The default is 0 for no limit.
The same error code RES_E2BIG is used for the client side limit as for the server side limit.
2023-04-27 08:48:49 -07:00
Pavel Djundik
7348cc11f7 Move working tests up a folder (#503)
Tests in the experimental/ folder were not executed on CI. The ones that work move up, the few
that remain in experimental/ need further investigation to get working or remove.
2023-04-27 08:35:07 -07:00
Rasmus Lerdorf
5833590296 zstd support (#539)
This adds zstd compression support.

The current two options, zlib and fastlz is basically a choice between performance and compression ratio.
You would choose zlib if you are memory-bound and fastlz if you are cpu-bound. With zstd, you get the
performance of fastlz with the compression of zlib. And often it wins on both. See this benchmark I ran
on json files of varying sizes: https://gist.github.com/rlerdorf/788f3d0144f9c5514d8fee9477cbe787

Taking just a 40k json blob, we see that zstd at compression level 3 reduces it to 8862 bytes. Our current
zlib 1 gets worse compression at 10091 bytes and takes longer both to compress and decompress.

      C Size  ratio%     C MB/s     D MB/s   SCORE      Name            File
        8037    19.9       0.58    2130.89       0.08   zstd 22         file-39.54k-json
        8204    20.3      31.85    2381.59       0.01   zstd 10         file-39.54k-json
        8371    20.7      47.52     547.12       0.01   zlib 9          file-39.54k-json
        8477    20.9      74.84     539.83       0.01   zlib 6          file-39.54k-json
        8862    21.9     449.86    2130.89       0.01   zstd 3          file-39.54k-json
        9171    22.7     554.62    2381.59       0.01   zstd 1          file-39.54k-json
       10091    24.9     153.94     481.99       0.01   zlib 1          file-39.54k-json
       10646    26.3      43.39    8097.40       0.01   lz4 16          file-39.54k-json
       10658    26.3      72.30    8097.40       0.01   lz4 10          file-39.54k-json
       13004    32.1    1396.10    6747.83       0.01   lz4 1           file-39.54k-json
       13321    32.9     440.08    1306.03       0.01   fastlz 2        file-39.54k-json
       14807    36.6     444.91    1156.77       0.01   fastlz 1        file-39.54k-json
       15517    38.3    1190.79    4048.70       0.02   zstd -10        file-39.54k-json

The fact that decompression a dramatically faster with zstd is a win for most common memcache uses
since they tend to be read-heavy. The PR also adds a `memcache.compression_level` INI switch which
currently only applies to zstd compression. It could probably be made to also apply to zlib and fastlz.
2023-04-27 08:32:10 -07:00
Remi Collet
fc388e65e7 fix ${var} deprecation 2022-06-03 16:56:00 +02:00
Remi Collet
1f22de7437 fix #513 skip test with old and dead libmemcached 2022-03-28 08:09:29 +02:00
Pavel Djundik
e45fef8634 Create gh_500.phpt 2022-03-07 15:37:52 +01:00
Aaron Stone
9cd4a01d99 Merge pull request #474 from m6w6/fix-memcachedserver
fix MemcachedServer
2021-08-22 22:05:26 -07:00
Timo Tijhof
6d457155fb Remove "failed to set key" warning from setMulti (#490)
This was introduced in https://github.com/php-memcached-dev/php-memcached/commit/6837d89494,
pull https://github.com/php-memcached-dev/php-memcached/pull/214. I suspect it
may have been a left-over from debugging something. The test was later
changed in 6837d89494 to expect the warning in question, although other
similar tests don't encounter such warning currently.

It appears no other Memcached methods emit a PHP Warning when they encounter
a write read or failure. Instead, they typically turn their return value
into boolean false, and provide details via getResultMessage().

The introduction of this warning since php-memcached 3.0 has led to a number
of confused consumers (locally #260, #409, #450, and more reports
within downstream issue trackers).

Closes https://github.com/php-memcached-dev/php-memcached/issues/409.
2021-08-22 21:56:19 -07:00
Remi Collet
10f449752b small sleep to avoid loosing message from subprocess 2021-07-23 14:55:28 +02:00
Remi Collet
2d5d4bf02f add IPv6 test 2021-07-23 14:55:28 +02:00
Michael Wallner
4e7f20cdb0 skip test with libmemcached < 1.1.0 2021-07-23 14:55:28 +02:00
Michael Wallner
4b6c45dd23 implement stats callback suggestions by Remi 2021-07-23 14:55:28 +02:00
Michael Wallner
9840866332 valgrind 2021-07-23 14:55:28 +02:00
Michael Wallner
bee6b53d57 expect an array as STATS value and reply foreach key/value 2021-07-23 14:55:28 +02:00
Michael Wallner
941ae83544 add stats/version tests 2021-07-23 14:55:28 +02:00
Michael Wallner
f064f6c817 fix running the server from command line 2021-07-23 14:55:28 +02:00
Remi Collet
d21814e647 minor fix for version handler 2021-07-23 14:55:27 +02:00
Remi Collet
57f2999ea5 add 1 test for MemcachedServer 2021-07-23 14:55:27 +02:00
Rasmus Lerdorf
7be9f00779 Add test 2021-06-09 18:09:33 +02:00
Remi Collet
0c3f411e71 fix test for PHP 8.1 2021-06-09 15:02:20 +02:00
Arjen de Korte
19a02bb5bf Don't expect tests/expire to fail (#475)
The issue reported in https://code.google.com/archive/p/memcached/issues/275 was fixed more than 8 years ago and the test is no longer expected to fail
2021-01-20 19:06:53 -08:00
Remi Collet
9a429d43f8 Promote error "Memcached constructor was not called" to exception with PHP 8 (#465)
For consistency with other PHP 8 extensions.
2020-11-17 03:04:15 -08:00
Remi Collet
e8f53777d3 generate arginfo from stub for PHP 7 and 8 2020-10-08 12:21:57 +02:00
Aaron Stone
c5618158c5 Handle fatal error in session badconf persistent test 2018-12-21 02:08:04 -08:00
Aaron Stone
0b79956e6d Error message if old PERSISTENT=n flag is used in session.save_path 2018-12-21 01:28:03 -08:00
Aaron Stone
e0ccf87c51 Avoid hanging getStats() when binary protocol and non-blocking are both enabled
Fixes #348.
2018-01-23 06:27:26 -08:00
Aaron Stone
5c6de2b0e4 Add support for libmemcached encryption (#381)
This feature is fully supported in libmemcached 1.0.18 and higher,
but has a notable bug in the original implementation in libmemcached
versions 1.0.6 - 1.0.17 that the encryption key, once set, cannot be
changed otherwise all further get/set operations fail.
2018-01-20 08:04:40 -08:00
Aaron Stone
39bfab06c0 In PHP 7.2 the session_start() error messages have changed a bit (#359)
See PHP Bug 71038 for details https://bugs.php.net/bug.php?id=71038
Added PHP 7.2.0alpha2 to Travis CI matrix
2017-07-11 15:57:51 -07:00
Aaron Stone
e91eae7be3 Split tests for invalid keys ascii and binary
Test get command for invalid keys as well as set command
2017-07-11 14:04:01 -07:00
Aaron Stone
43bbf00802 In PHP 7.2, php_errormsg is deprecated 2017-07-07 19:15:28 -07:00
Remi Collet
3b3e63dac7 typo in skip message (#331) 2017-02-21 22:47:15 +00:00
Aaron Stone
99cab0e081 Fix session-persistent test failures on older libmemcached versions 2017-02-19 17:23:35 -08:00
Xinchen Hui
bff303547f Fixed memleak (severs) 2017-02-19 18:32:16 +08:00
Aaron Stone
f7c92b0699 Update warning for touch command in binary protocol mode with libmemcached < 1.0.18 (#322) 2017-02-12 15:56:22 +00:00
Aaron Stone
83d5f30899 Separate test for 64-bit increment/decrement/incrementByKey/decrementByKey (#321) 2017-02-10 13:51:14 +00:00
Remi Collet
f8fd6228e3 ensure tests are ok for 32bits build 2017-02-09 07:24:15 +01:00
Aaron Stone
6085768b48 Support for 64-bit offsets for increment and decrement (#306)
While the memcached protocol allows for 64-bit increments or decrements,
there is a quirk in the libmemcached API that the memcached_increment()
and memcached_decrement() functions take only a 32-bit adjustment value.

Since the memcached_increment_by_key() and memcached_decrement_by_key()
functions do accept 64-bit adjustment values, and the memcached_increment() and
memcached_decrement() functions are simply wrappers around those, we'll use
them directly and thus support 64-bit adjustments in all cases.
2017-01-26 02:06:30 +00:00
Aaron Stone
c85f34c01b Make sure that s_compress_value() will always leave a valid payload, even if it did not get compressed 2017-01-25 00:52:45 -08:00
Dick Tang
7283b11d14 test: compression edge case verification (#256)
test compressed SET/GET under various settings of
- compression_factor
- compression_threshold
- data length
2017-01-25 00:51:49 -08:00
Samantha Quiñones
9debfacb8c Extended key checking to match the language of the memcached spec (#167)
Updated to php7 branch by Aaron Stone <aaron@serendipity.cx>
2017-01-24 01:12:03 -08:00
Arjen
172d1ffe69 Fix tests for PHP 7.1 (#297)
invoke_callback_2 fails because of ArgumentCountException (init_cb_arg gets only 2 args)
Check number of passed arguments with func_num_args() insteadof checking $args is null

session_lock fails because of second warning in 7.1
Skip session_lock.phpt for php < 7.1 and create new testcase for >= 7.1 which tests both warnings.

Update .travis.yml, don't allow failures for 7.1 anymore!
2017-01-20 18:14:54 +00:00
Arjen
7f6c333032 Cannot reset OPT_PREFIX_KEY #293 (#294)
- ZSTR_VAL(str) == 0 should be ZSTR_LEN(str) == 0
- add reset_keyprefix.phpt to package.xml
2017-01-20 12:20:42 +00:00
Xinchen Hui
4fa21116f1 Value pass to callback behavior consistently with get
(GET_EXTENED return array)
2016-07-26 19:11:54 +08:00
Xinchen Hui
41b005fd0f Fixed test 2016-07-26 17:48:00 +08:00
Xinchen Hui
6837d89494 Fixed test (tests/experimental/setmulti_badserialize.phpt) 2016-07-23 20:44:03 +08:00
Xinchen Hui
513c091a67 Fixed locale_float.phpt test 2016-07-23 20:13:47 +08:00
Xinchen Hui
5949598db6 Remove unused arg 2016-07-23 15:18:54 +08:00
Xinchen Hui
a0ed436fca According to memcached wiki, touch is added since 1.4.8
https://github.com/memcached/memcached/wiki/ReleaseNotes148
2016-07-23 15:15:30 +08:00