memory – Internetblog.org.uk https://www.internetblog.org.uk Web hosting, Domain names, Dedicated servers Fri, 29 Jan 2016 11:05:52 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.5 https://www.internetblog.org.uk/files/2016/01/cropped-favico-32x32.png memory – Internetblog.org.uk https://www.internetblog.org.uk 32 32 How to Increase MySQL Memory Usage Above 4GB https://www.internetblog.org.uk/post/1527/how-to-increase-mysql-memory-usage-above-4gb/ Tue, 13 Jul 2010 19:11:35 +0000 http://www.internetblog.org.uk/post/1527/how-to-increase-mysql-memory-usage-above-4gb/ RAM memory modules
Question: My database server is timing out because MySQL seems to hang once it has used up 4GB of RAM, even though the server is equipped with 6GB. How can I make MySQL take advantage of the full 6GB available?

Answer: If your current server setup involves a 32-bit architecture or even just a 32-bit version of your operating system, the short answer is: you cannot. By design MySQL will not be able to use more than 4GB unless it is running on a 64-bit OS.

If you are running Linux, type ” uname -m ” from the command line to see whether or not you are using a 64-bit version. If you know for a fact that your server actually has 64-bit processors, you can reinstall Linux with a 64-bit kernel.

The other less-drastic measure you may be able to take is to install a PAE (Physical Address Extension) kernel, which will allow your server to access physical address space larger than 4 GB. Some distributions, such as CentOS offer PAE kernel packages that you can easily install.

Source: Webhostingtalk.com
Photo: Flickr

]]>
MySQL Optimization: Part 2 https://www.internetblog.org.uk/post/1492/mysql-optimization-part-2/ Fri, 02 Jul 2010 14:48:08 +0000 http://www.internetblog.org.uk/post/1492/mysql-optimization-part-2/ Mysql logo1. Query cache – On most servers, there are certain MySQL queries that you and/or your scripts will run more often than others. In fact, you may run the same query hundreds or even thousands of times in a single day. The query_cache setting will save the most used queries in memory for quick access

query_cache_limit=1M
query_cache_size=32M (32MB for every 1GB of RAM)
query_cache_type=1

2. Key buffer size – This refers to the size of buffers used for indexes. A larger buffer will result in faster SQL response time when a command is issued. The key_buffer_size should be at least 1/4 but no more than 1/2 of the RAM size of the server.

key_buffer=256M (128MB for every 1GB of RAM)

3. Table cache – Just like MySQL can cache queries, it can also cache tables. If you think about how often a database table would be accessed, especially when using content management systems and web applications, this only makes sense. You can adjust this according to your memory.

table_cache=1500

Next week, we will cover more MySQL optimization tips.

Source: linuxstuffs

]]>
Virtual machine memory allocation https://www.internetblog.org.uk/post/991/virtual-machine-memory-allocation/ Fri, 12 Feb 2010 22:25:41 +0000 http://www.internetblog.org.uk/post/991/virtual-machine-memory-allocation/ VMWare ESXi
Question: How much memory will I need to run virtual machines on my server?

Answer: There is no simple answer to this question. Generally speaking, to virtualize an operating system you need at least as much RAM as is normally required to run the OS independently. Therefore, if your OS requires 512MB of RAM to run normally, it will require that in virtualization.

It is, however, not quite that simple. Depending on your application needs, server loads, and the amount of data being accessed and transferred, your needs could range from the low (512MB) to the high (4GB) or even beyond that.

Therefore, it is important to know exactly what you need and how much RAM you would normally need to run the applications you are trying to run. Some virtualization software also includes dynamic memory allocation so that you can set a base amount and allow the amount used to expand on an as-needed basis. As with anything that might tax your server’s load, use it wisely.

Photo: Flickr

]]>
How to set resource limits on PHP https://www.internetblog.org.uk/post/972/how-to-set-resource-limits-on-php/ Mon, 08 Feb 2010 23:18:15 +0000 http://www.internetblog.org.uk/post/971/how-to-set-resource-limits-on-php/ PHP logoIn a previous post, we learned how to increase the memory limit on PHP by editing the php.ini file. But limits exist for a reason, and although you would probably love to give every process, every script, and every website unlimited CPU cycles, memory, and bandwidth, it just isn’t possible.

To begin editing, open /etc/php.ini in your text editor of choice. For example:

# nano /etc/php.ini

Look for the following values and change them to fit your requirements for your server. Below are just suggested values:

max_execution_time = 30
max_input_time = 30
memory_limit = 40M
post_max_size = 8M
upload_max_filesize = 2M

You may need to adjust the actual size limits to meet the requirements of certain content management systems or scripts, but be sure to not get carried away with being too liberal.

]]>
Identifying memory consumption by process in Linux https://www.internetblog.org.uk/post/920/identifying-memory-consumption-by-process-in-linux/ Mon, 25 Jan 2010 16:44:59 +0000 http://www.internetblog.org.uk/post/919/identifying-memory-consumption-by-process-in-linux/ pmap command output
Question: How do I find out how memory is used by a particular process in Linux?

Answer: On a Linux server, a nifty little command called “pmap” will do just what you want. The command string that you will need to enter as root is:

# pmap -d PID

But first you will need to know what the PID is. To find the PID for a particular process, run the “ps” command as explained in a previous post. Once you have the process ID, you are now ready to find out more about it. For this example, let’s suppose the PID is 22938. You would enter:

# pmap -d 22938

What you get in a complete memory usage output of every library, command, and file used by that process. For example, 22938 on my computer happened to be Firefox. On a server, it would obviously be something server-related. If Firefox is hogging memory or causing problems, I can pinpoint the exact source of the memory consumption.

Source: nixCraft

]]>
System monitoring with phpSysInfo https://www.internetblog.org.uk/post/832/system-monitoring-with-phpsysinfo/ Tue, 29 Dec 2009 19:38:08 +0000 http://www.internetblog.org.uk/post/832/system-monitoring-with-phpsysinfo/ phpSysInfo screenshot
Sometimes you just need quick information about your server without having to click through numerous control panel screens or logging via SSH. A small PHP software application, called phpSysInfo, allows you to do just that. Installed like a normal PHP script, you can access a plethora of information about your server, including:

Hostname, Listening IP, Kernel version, Distribution name, Uptime, Current number of users, Load averages, Processors, Devices, Memory, Filesystems, Network usage, and Information about running processes. All of this is presented in a user-friendly graphical format that has a changeable theme.

phpSysInfo is available for Linux, BSD, Winows, OS X, and all UNIX-like operating systems. It is completely web-based and is free software, releated under the GNU GPL. You can download it from sourceforge.net free of charge.

]]>
PHP Memory Limit https://www.internetblog.org.uk/post/582/php-memory-limit/ Thu, 15 Oct 2009 21:57:40 +0000 http://www.internetblog.org.uk/post/582/php-memory-limit/ PHP Elephant

Question: My PHP content management program “X” needs more RAM. How do I fix this?

Answer: Depending on your server setup and whether you have shared hosting or a dedicated server, you may or may not be able to change the allowed PHP memory usage. What happens is that PHP is setup to allow a certain amount of data to be sent over the web before it times out and give you an error. The default is usually 8MB, which is not enough for large databases.

The solution is to increase the memory allowance. Normally, if it is done server-wide, you simply edit the php.ini file and find something that looks like:

“memory_limit = 8M”

If you want a 32MB limit, simplyl change it to:

memory_limit = 32M

If you are using a shared hosting account, there are several methods that a web hosting provider can use to allow you to change the settings, while some might not allow it at all. Check their documentation and, if necessary, contact them.

Photo Source: Flickr

]]>
Understanding Linux RAM Usage https://www.internetblog.org.uk/post/543/understanding-linux-ram-usage/ Fri, 02 Oct 2009 19:50:59 +0000 http://www.internetblog.org.uk/post/542/understanding-linux-ram-usage/ memory usage graphs
Question: I run Windows on my home computer, and I noticed that my Linux dedicated server is always using a lot of RAM. Why?

Answer: Windows and Linux utilize RAM in different ways. Someone new to Linux might be alarmed to see that the amount of free RAM Linux leaves available is very small. Like Windows, Linux has virtual memory functionality, but there are two main differences:

1. Windows uses a single file, called a page file, which can grow and shrink, while Linux uses a swap partition of a fixed size.

2. Linux caches applications. For example, if Postfix, a mail server program, starts and sends some email messages, Linux will remember it even after the program shuts down. The next time it is used, it will start faster since it is cached in the memory.

Linux will keep remembering and caching applications until most of the RAM is used. Otherwise, your RAM just sits there with no purpose. But when more applications need the RAM, Linux will automatically flush the cache to make room. Therefore, if you have enough RAM, you will hardly ever need to use your swap partition.

]]>