Large concurrent pressure measurement, Redis connection Abnormal read timed out troubleshooting optimization

Source: Internet
Author: User

pressure measurement Business process: to obtain the country-wide regional information, the first access to information from MySQL, access to information after Hset to Redis, after the acquisition of information are gone Redis get and return interface data.

problem:20 concurrent pressure measurement to obtain nationwide information, the application of error, Getlist:merchant:area:listerror,redis connection exception read timed out (10 concurrent normal), the application throws an error:

Redis.clients.jedis.exceptions.JedisConnectionException:Could not get a resource from the pool. In fact, here are a few problems caused by the first adjustment redis maximum number of connections

Troubleshoot positioning:

Server resource utilization is normal, memory, disk, etc. more adequate

Redis connection configuration is normal, redis.pool.maxidle=300,redis.pool.maxtotal=600.

The number of Redis connections is normal, netstat-nap|grep Redis |wc-l,100 multiple active connections.

Redis-info View Redis information Connection Normal, normal connection more than 100.

Redis-monitor gets normal data, get and hget data are normal.

Check the Redis log for the following questions:

WARNING Overcommit_memory is set to 0! BackgroundSave may fail under low memory condition. To the fix this issue add ' vm.overcommit_memory = 1 ' to/etc/sysctl.conf and then reboot or run Thecommand ' sysctl Vm.overcommi T_memory=1 ' for this to take effect.

Optimizations:vim/etc/sysctl.conf, adding Vm.overcommit_memory=1, and then sysctl-p the configuration file to take effect

Note: Kernel parameter vm.overcommit_memory represents a memory allocation policy with a value of 0, 1, 2:

0 indicates that the kernel will check if there is enough available memory to use the process, and if there is enough memory available, the memory request is allowed, otherwise the memory request fails and the error is returned to the application process.
1 indicates that the kernel allows all physical memory to be allocated regardless of the current state of memory.
2, which indicates that the kernel allows to allocate more memory than the sum of all physical memory and swap space

If after the optimization of the parameters, the problem still exists, reference connection: http://www.cnblogs.com/qlong8807/p/5149007.html

Other optimization: due to the large amount of business return data, finally take the optimization scheme as follows: The front end of the call to write the data separately die in JS, take the CDN to obtain data, reduce the interaction with the backend.

Related Article

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.