increase item max size in memcached? - memcached

i am using memcached on my centos server , my project is large and has objects more than 1MB which i need to save to memcached , well , i can't ! because the max_item_size is 1MB , anyway to edit that ?
Thank you

You can change the limit quickly by edit the configuration file [/etc/memcached.conf] adding:
# Increase limit
-I 128M
Or if you have trouble with SO config run it with command line directly
memcached -I 128M

If you are using Memcache >= 1.4.2, this is now configurable. Here is an example of how to set this in your init script for starting Memcache on CentOS: http://www.alphadevx.com/a/387-Changing-the-maximum-item-size-allowed-by-Memcache

You can compile memcached and change the memory allocation setting to use POWER_BLOCK's, in the slabs.c file (or you can recompile and user malloc/free, but that is the greater of the evils).
http://code.google.com/p/memcached/wiki/FAQ#Why_are_items_limited_to_1_megabyte_in_size?
I would seriously consider what you are caching and how it can be more modular, > 1MB in active memory is large.

Spent tons of time to figure this out:
in /etc/sysconfig/memcached edit options
OPTIONS="-l 127.0.0.1 -I 3m"
then systemctl restart memcached to take effect.
Would recommend option -l 127.0.0.1 it secures to localhost usage only and -I 3m increases the limit as described above.
With Centos 7 I had no luck with these paths /etc/memcached.conf /etc/default/memcached

Related

PGbouncer ERROR accept() failed: Too many open files

I am running a server with 20 cpu cores and 96 GB of ram. I have configured Postgresql and Pgbouncer to handle 1000 connections at a time.
However when the connections increase (even though they are well below the 1000 limit I have set) I start getting failed connections. I checked the pgbouncer log and I noticed the following
ERROR accept() failed: Too many open files
What limit do I need to increase to solve this issue? I am running Debian 8
Increate the operating system limit of the maximum number of open files for the user under which pgBouncer is running.
I added the below parameters in the pgBouncer service. After that, pgbanch was run again. So problems was solved.
The file limit size depend on your Linux file size. You checked your system with these codes.
cat /proc/sys/fs/file-max
ulimit -n
ulimit -Sn
ulimit -Hn
vim /lib/systemd/system/pgbouncer.service
[Service]
LimitNOFILE=64000
LimitNOFILESoft=64000

Cleanup of Mongo journal file

Is there a way to reset the journal file. Will it have any implications ?
Right now i have a journal file of 2GB which is occupying lot of space in ec2.
You should stop the mongodb first:
service mongodb stop
rm -rf /var/lib/mongodb/journal
service mongodb start
Additional hint: you could limit the journal to 128MB by adding smallfiles=true to the config file /etc/mongodb.conf.
Solution taken from here and tested on Ubuntu 16.04.
No need to restart mongod service - this is not good solution sometime.
There is more simple solution if you just want to cleanup the single log file:
echo '' > /var/lib/mongodb/journal.log

How to clear cache in OpenVZ?

I have OpenVZ VPS and have problem with clearing the cache:
In OpenVZ not work echo 3 > /proc/sys/vm/drop_caches
How may be this cache clear?
This was reported on the OpenVZ bug tracker. It has been resolved as RESOLVED WONTFIX
From Kir Kolyshkin in the bug report (project leader of OpenVZ):
All containers share the same page cache (although there is per-container accounting), so to drop caches of one single container we have to check each page:
1 Whether it belongs to the container or not -- supposing we do have that information, which I am not sure of
2 Whether this page is used by other containers.
So, while this is trivial on the host system, it is much less trivial for a container. And this is not a critical piece of functionality -- drop_caches is only useful for running various sorts of benchmarks.
Since your don't get your own kernel instance with OpenVZ you are prevented from running the command.
As a result, in order to clear the cache -> must restart VPS.
OpenVZ don't support to clear cash.
Could you try doing below steps -
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
sudo echo 3 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
echo 3 | sudo tee /proc/sys/vm/drop_caches
If these steps doesn't work -
Get a real non-OpenVZ machine (KVM, Xen, etc) and this will work just fine. With OpenVZ, you don't get your own kernel instance and as such, are restricted from performing commands like this.

Increase image upload limt

Whenever I try to upload an Image larger than 125Kb, I receive Upload HTTP Error. How can I increase this limit so I can upload Hi-res images?
Thank you,
FD
This has nothing to do with Magento and everything to do with your server settings.
You will likely have to bump up post_max_size and upload_max_filesize in your php.ini
Also, if you're running NGINX you may also have to increase client_max_body_size
Please note, however, that settings and restrictions can vary greatly from one hosting environment to the next. If you're not sure how to alter the config files properly or do not have the necessary access to do so - then you may have to contact your hosting provider and ask them to do it for you.
First of all, make sure that you have correct permissions for your media dir using command line:
sudo chmod -R 775 [magento_root]/media
If it doesn't help, try to check your php config:
php -i | egrep 'upload_max_filesize|post_max_size|memory_limit'
If you see the small values there, you, probably, need to change limits by editing these limits in your php.ini file. You can find this file by running the following command
php -i | grep php.ini
Also, do not forget to restart your apache/php servers after some config changes have been made. Usually, you are able to do it by running:
sudo /etc/init.d/apache2 restart
or
sudo service apache2 restart
Also, I noticed that sometimes mod_security might cause such kind of issues. Try to check your [magento_root]/.htaccess file for the following configuration and try to add it if it's absent:
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
And, the last thing: try to upload images from another browser/computer. Magento has flash uploader for product images and we have cases when the flash player caused the similar issues on some computers.
You have to change both post_max_size and upload_max_filesize in the php.ini
And don’t forget to restart your server afterwards.

my memcached server have to be "flush_all" per about 12 hours ,unless the app would down soon

my memcached server have to be "flush_all" per about 12 hours ,unless the app would down soon.
if i ignore some memcached settings? my app based on java/tomcat
i startup memcached by typed "nohup ./memcached -p [port] -m 8192" that all,
i' can't found the configure file of my memcached server.
i installing memcached by typed tar zxf memcached-version.tar.gz
cd memcached-version/
./configure -prefix /usr
make && make install
How much memory do you have on that machine? if you have 8G, what might be happening is that memcached is taking up all the memory available on the machine.
if so, just change the memcached startupline to -m 5000 or so.