php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59699 Compression Flag does not work as expected
Submitted: 2011-04-04 13:24 UTC Modified: 2011-04-04 15:32 UTC
From: leo dot buettiker at gmx dot ch Assigned:
Status: Open Package: memcache (PECL)
PHP Version: 5.3.5 OS: GNU/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: leo dot buettiker at gmx dot ch
New email:
PHP Version: OS:

 

 [2011-04-04 13:24 UTC] leo dot buettiker at gmx dot ch
Description:
------------
I would expect content set with Memcache::set to be not compressed unless the flag MEMCACHE_COMPRESSED is set. But the content is always compressed.

Memcache Version:3.0.4
PHP Version: 5.3.6 (cli)(could not enter this version in bug tracking)
Memcached Server Version: 1.4.4
OS: Linux ip-10-58-149-116 2.6.35.11-83.9.amzn1.x86_64 #1 SMP Sat Feb 19 23:42:04 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Testcontent: The first 512K of http://dumps.wikimedia.org/enwiki/latest/enwiki-latest-abstract1.xml

Compression:
[ec2-user@ip-10-58-149-116 ~]$ ls -lh wiki.txt
-rw-rw-r-- 1 ec2-user ec2-user 512K Apr  4 16:54 wiki.txt
[ec2-user@ip-10-58-149-116 ~]$ gzip wiki.txt
[ec2-user@ip-10-58-149-116 ~]$ ls -lh wiki.txt.gz
-rw-rw-r-- 1 ec2-user ec2-user 68K Apr  4 16:54 wiki.txt.gz

Reproduce code:
---------------
<?php
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");

$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\n";

$stat = $memcache->getStats();
echo $stat['bytes']."\n"; //expect 0

$memcache->set("wiki_uncompressed", file_get_contents("wiki.txt"), false, 360) or die ("Failed to save data at the server");
$stat = $memcache->getStats();
echo $stat['bytes']."\n"; //expect ~524 288

$memcache->set("wiki_compressed", file_get_contents("wiki.txt"), MEMCACHE_COMPRESSED, 360) or die ("Failed to save data at the server");
$stat = $memcache->getStats();
echo $stat['bytes']."\n"; //expect less then 1 000 000


Expected result:
----------------
Server's version: 1.4.4<br/>
0
524288
593525

Actual result:
--------------
Server's version: 1.4.4<br/>
0
69237
138472


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-04 14:00 UTC] leo dot buettiker at gmx dot ch
I upgraded now to Memcache Version 3.0.5, same here
 [2011-04-04 15:32 UTC] leo dot buettiker at gmx dot ch
Likely that this is only a documentation issue. As far as I understand the source code, memcache.compress_threshold is set to 20000 by default.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 11:01:27 2019 UTC