Archive for the tag 'memory'

Fix For Memory Error in Ensim Pro for Linux Version

Restore of appliance, reseller, site and user fails with the “MemoryError” if the size of the backup tar file is greater than the aggregate size of RAM and swap space.

Instructions to fix MemoryError exception occuring during import sites.

Resolution: Add extra swap space to the server before doing the restore. The extra swap space is added to the server by setting up a new swap file and enabling swapping on it.

Instructions to setup swap file:

Select the partition where you want to create the swap file. This partition must have free disk space to create the swap file.

Create a file for swap with the following command (# is shell prompt):

#dd if=/dev/zero of=/var/swapfile bs=1024 count=

Where = number of 1024 blocks required. If count=1024000 size of /var/swapfile will be 1024* 1024000 = 1 GB.

Setup an extra swap with the following command:

#mkswap /var/swapfile

Enable “/var/swapfile” for swapping with the following command:

#swapon /var/swapfile

Verification: The file “/proc/swaps” must contain the entry for the swap file “/var/swapfile”. If this entry is not present, then swapping has not been enabled for the swap area.

Restore can be performed after the extra swap file has been enabled for swapping.

Instructions for deleting the swap file after import:

Turn off swapping for file “/var/swapfile” with the following command:

#swapoff /var/swapfile

Delete the file “/var/swapfile” with the following command:

#rm -f /var/swapfile
SB-Shibu

Shared Memory Pages

Shared Memory Pages

To facilitate data sharing, you can create shared memory pages. Multiple processes can read and write to and from a common shared memory area. The kernel maintains and administers the shared memory areas and allows individual processes access to the shared area.

The special ipcs command allows you to view the current shared memory pages on the system. Here’s the output from a sample ipcs command.

root@dell:~# ipcs -u

—— Shared Memory Status ——–
segments allocated 6
pages allocated 576
pages resident 528
pages swapped 0
Swap performance: 0 attempts 0 successes

—— Semaphore Status ——–
used arrays = 0
allocated semaphores = 0

—— Messages: Status ——–
allocated queues = 0
used headers = 0
used space = 0 bytes

Each shared memory segment has an owner that created the segment. Each segment also has a standard Linux permissions setting that sets the availability of the segment for other users. The key value is used to allow other users to gain access to the shared memory segment.

-m shared memory segments

root@dell:~# ipcs -m

—— Shared Memory Segments ——–
key shmid owner perms bytes nattch status
0×00000000 327680 buddy 600 393216 2 dest
0×00000000 360449 buddy 600 393216 2 dest
0×00000000 262146 buddy 600 393216 2 dest
0×00000000 294915 buddy 600 393216 2 dest
0×00000000 393220 buddy 600 393216 2 dest
0×00000000 425989 buddy 600 393216 2 dest

SB-Shibu

Shared Memory

Shared Memory?

Shared memory (SHM) is another method of interprocess communication (IPC) whereby 2 or more processes share a single chunk of memory to communicate. The shared memory system can also be used to set permissions on memory, allowing for things like malloc debuggers to be written.

Types of Shared memory available

Basically there are two different types of shared memory available for most flavors of UNIX. As you may have guessed, each of the two orignal ancestors of modern UNIX have their own implementation, altough almost all modern UNIX flavors implement both. The names of the respective implementations are System V IPC, and BSD mmap.

SB-Shibu

Increasing PHP Allowed memory size

Some times we get the following errors Fatal error: Allowed memory size of 123456 bytes exhausted

Php is setup is to limit memory usage per process. If we require more, this limit can be increased.

Edit

/usr/local/lib/php.ini

and set:

memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)

to a higher value, like 20M. Save, exit, then restart apache.

Source: http://directadmin.com/

SB-Shibu

Resolving high MySQL memory usage.

On RHEL uses a memory efficient /etc/my.cnf file. If you install MySQL on a Debian server, edit the key_buffer_size setting in /etc/mysql/my.cnf. A small value like 2M often works well. For an ultra-tiny setup add or change the follow entries to the mysqld section:

# if your are not using the innodb table manager, then just skip it to save some memory
#skip-innodb
innodb_buffer_pool_size = 16k
key_buffer_size = 16k
myisam_sort_buffer_size = 16k
query_cache_size = 1M