Configuration and deployment of high-performance Web server Nginx (12) Application module memcached problems caused by compressing file cache

Source: Internet
Author: User

In the previous article, it was mentioned that the Nginx memcached module application scenario, mainly as a file cache. Then a problem is found, when large files are cached in a byte array, the cached data is compressed, which can cause problems when reading.


(This article welcomes reprint, respect for others labor, reproduced please specify the Source: http://blog.csdn.net/poechant/article/details/7177603)


The workaround is simply to set the compression threshold on the memcachedclient side. If you are using the Net.spy.memcached API, you can set the following:

    1. int expire_seconds = 18000;
    2. Serializingtranscoder transcoder = new Serializingtranscoder ();
    3. Transcoder.setcompressionthreshold (5242880);
    4. Filecache.set (Key, Expire_seconds, value, transcoder);


If you are using the Net.rubyeye.xmemcached API, you can set the following:

    1. int expire_seconds = 18000;
    2. Baseserializingtranscoder transcoder = new Baseserializingtranscoder ();
    3. Transcoder.setcompressionthreshold (5242880);
    4. Client = set (key, Expire_seconds, value, transcoder);


If you are using Danga. Memcached API, you can set the following:

      1. int expire_seconds = 18000;
      2. Memcachedclient.setcompressthreshold (5242880);
      3. Memcachedclient.set (key, value, new Date (System.currenttimemillis () + expire_seconds * 1000L));

Configuration and deployment of high-performance Web server Nginx (12) Application module memcached problems caused by compressing file cache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.