Commit Graph

27 Commits

Author SHA1 Message Date
Robert
dfd038f13c Correct whitespace formatting (#553) 2023-12-27 16:55:59 -08: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
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
LeoLee
1eac9f8b8e PHP 8 compatibility Windows (#528)
Use PHP_VERSION_ID instead of _MSC_VER to select the right headers. win32/php_stdint.h
was removed in PHP 8.0.0 and php_stdint.h file was removed in PHP 8.2.0 entirely:
https://github.com/php/php-src/blob/PHP-8.2/UPGRADING.INTERNALS#L26
2023-01-31 14:45:26 -08:00
lfeng
082615656f format code 2021-12-30 14:04:09 +08:00
lfeng
5a8db865c1 format code 2021-12-30 10:08:48 +08:00
lfeng
7a06230982 fix windows php8 php_stdint.h path 2021-12-29 16:24:57 +08:00
Xander
6d8f5d524f Windows fixes (#411) 2018-11-14 16:27:53 -08:00
Peter Kokot
f5f84c592f Remove unused Git attributes ident (#402)
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-06-30 10:00:44 -07:00
Aaron Stone
f4dafd207e Add INI setting to choose session consistent hash (ketama or ketama_weighted) (#392)
Provides a new INI option to select the same consistent hash behavior as
older versions of php-memcached, to aid in migration from PHP 5.x to PHP
7.x. When `memcached_sess_consistent_hash_type` is set to `ketama` or
`ketama_weighted`, that sets either MEMCACHED_BEHAVIOR_KETAMA or
MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, respectively.

Resolves #344
2018-04-08 19:41:01 -07:00
Aaron Stone
8bfdbcc906 Update for new PHP 7.3 REFCOUNT macros (#390) 2018-03-29 23:26:46 -07:00
Aaron Stone
fa620a48c4 Restore php_libmemcached_compat with workaround for missing memcached_exists (#314)
This partially reverts commit c564fd875e from #295
2017-02-07 12:34:07 +00:00
Arjen
c564fd875e Cleanup all checks for unsupported libmemcached versions (#295) 2017-01-20 13:26:57 +00:00
Aaron Stone
957024f777 Consistently use #ifdef instead of #if for autoconf definitions 2016-10-11 07:53:47 -07:00
Aaron Stone
5bcf2008ee Use only the HAVE_MEMCACHED_SASL definition from config.h 2016-10-11 07:53:47 -07:00
Xinchen Hui
bb4556a38c Partial fix build for memcached-protocl 2016-07-25 08:38:22 -07:00
Mikko
6ace07da69 Tests for default behavior 2016-02-17 14:39:49 +01:00
Mikko
a930b41fa1 Fixes memory errors, broken code, bugs etc 2016-02-06 05:07:52 +00:00
Mikko
782077ce57 Fix json serializer 2016-01-31 23:11:11 +00:00
Mikko
bdd0911a9b Update to a simpler object structure, make session config match old setting names, key validation removed etc 2016-01-31 16:07:48 +00:00
Mikko
dc5b22a8da Cleaning up driver for php7. WIP 2016-01-29 14:58:50 +00:00
Mikko
7cb0c48c8d Fixes to session 2016-01-21 13:42:17 +00:00
Rasmus Lerdorf
949195d28b PHP7 Support 2015-02-03 08:02:42 -08:00
Remi Collet
c616a1be16 Fix php_memcached_server.c:589:49: warning: array subscript is above array bounds 2014-03-13 10:41:21 +01:00
Mikko
619302c1ef These settings are not needed if sasl is disabled 2013-11-25 16:23:06 +08:00
Mikko
a437602912 Reorganise headers a bit, include everything in the private header 2013-11-24 13:48:52 +08:00
Mikko
26ac8bd9cb Refactor SASL support checking, move "unnecessary" things to private header, move travis script to .travis dir 2013-11-24 00:00:59 +08:00