Centos Clear Cache Memory



  1. Centos Clear Cache Memory Mac
  2. Centos Clear Cache Memory
  3. Linux Clear Memory Cache
  4. Clear Dns Cache Centos

To retain the cached packages, change the keepcache setting to 1 in the /etc/yum.conf file as follows: # vi /etc/yum.conf keepcache = 1 Cleaning the Yum Cache Clean the Yum cache to reclaim disk space or to clear errors due to corrupted metadata files. If you have to clear buffer cache regularly, use the cronjob do it. Schedule the following in system crontab to automatically flush cache memory on a regular interval. Open a terminal and execute ‘crontab -e’ command to edit crontab.

Setting a cron to clear RAM cache everyday 2 hours. root@linuxhelp # crontab -e Append the following line, save and exit to execute it at 2 hours daily. 0 2. /path/to/script.sh To clear automatically the RAM cache on production server On the scheduled time, the script executes and clear everything in cache.

Centos Clear Cache Memory

In this article we will discuss a very important technique for boosting the performance of your Linux systems. We will flush / clear Linux system’s memory cache at a periodic periods to increase the available free memory space for other processes running on your Linux box.

Linux systems have implemented a memory management efficiently and even more than that. But many times Linux systems face a low memory issues due to either the number of running processes “heavy loaded systems” or a hungry process that eating your server’s memory, this force Linux systems to use the swap space to cache a processes data, which also decrease the system performance “If swapping is enabled”.

Cache is used to keep data to use frequently by operating system always available. Reading data from cache is much much faster than reading data from hard drive “actually this a mistake to compare reading data from RAM and reading data from hard disk”.
It’s good for OSes to get data from cache in memory and if any data not found in the cache, it reads from hard disk. So it’s no problem to flush cache memory.

Here’s we will show you how to Flush Memory Cache and swap space on Linux Server.

So, Let’s start

Flush Linux Memory Buffer Cache:

There are three options available in Linux systems to flush memory cache. We listing them in a descending order of the amount of freed memory space. Use one of below as per your requirements.

  • Free pagecache, dentries and inodes in cache memory
  • Free dentries and inodes use following command
  • Free pagecache only use following command

sync will flush file system buffers, it forces changed blocks to disk, update the super block. Then we drop the memory caches.

Schedule Cron to Flush Cache Regularly

Its a good idea to schedule following in crontab to automatically flush cache on regular periods. Append the following cron job to your root existing cron jobs

The above cron job will be executed every three hours and flushes all cached memory on system. This will give us the maximum amount of RAM we can free. This schduale can be used for staging and development servers,but for production servers it’s not good idea to clear cache every three hours.

Memory

For your production server’s just choose the time where only few users are connected to your server and run the above cron job once per day at that time.

Let’s assume that your server has a few /no users using it at 2 AM, so you will run the above cron job daily at 2 AM using the following command:

Now, we are save from any slowness your users can face during the emptying cache time.

Find Cache Memory uses in Linux

Use free command to find out cache memory uses by Linux system. Output of free command is like below

Sample Output

Last column is showing cached memory ( 590 MB) by system. -m option is used for showing memory details in MB’s. In our system we also use a disk swap partition, So If you want to free it also, see the following part:

How to Clear Swap Space in Linux?

If you want to clear Swap space, you may like to run the below command.

To free the swap partition just turn it off the turn it back on.

Here’s comes three important questions we must answer on them:

Centos Clear Cache Memory Mac

Is it a good idea to free Buffer and Cache in Linux that might be used by Linux Kernel?

When you are applying various settings and want to check, if it is actually implemented specially on I/O-extensive benchmark, then you may need to clear buffer cache. You can drop cache as explained above without rebooting the System i.e., no downtime required.

Linux is designed in such a way that it looks into disk cache before looking onto the disk. If it finds the resource in the cache, then the request doesn’t reach the disk. If we clean the cache, the disk cache will be less useful as the OS will look for the resource on the disk.

Moreover it will also slow the system for a few seconds while the cache is cleaned and every resource required by OS is loaded again in the disk-cache.

Is it good idea to auto clear RAM cache on production server?

No! it is not. Think of a situation when you have scheduled the script to clear ram cache everyday at 2am. Everyday at 2am the script is executed and it flushes your RAM cache. One day for whatsoever reason, may be more than expected users are online on your website and seeking resource from your server.

At the same time scheduled script run and clears everything in cache. Now all the user are fetching data from disk. It will result in server crash and corrupt the database. So clear ram-cache only when required,and known your foot steps, else you are a Cargo Cult System Administrator.

Is it good idea to Swap space on production server?

No! it’s not. Never use swap space on heavily loaded production server’s. Swap space can be used in staging and development servers as they just for testing and developments purposes. Instead of using swap space increase you ram size. Swap space had important rule in old days. In those days the ram memory size was too small and too expensive so came the importance of swap space.

Now a days, The ram has huge size with moderate cost so no need to use swap space on production servers, because it decreases the server performance “actually it kills the server performance”.

Summary

In this article we explained how to clear different types of memory caches “page cache,dentries and inodes” and clear swap space. According to your system you can decide when and how to free the cache memory, You can determine which cache type you will free. Finally do not user swap space in production servers.

I hope this article is good enough for you.
See you in other articles

If You Appreciate What We Do Here On Mimastech, You Should Consider:

  1. Stay Connected to: Facebook | Twitter | Google+
  2. Support us via PayPal Donation
  3. Subscribe to our email newsletters.
  4. Tell other sysadmins / friends about Us - Share and Like our posts and services

We are thankful for your never ending support.

Howto allow ruby on rails 4 app to be embedded into another website via iframe (Previous Post)
(Next Post) How to Mount S3 Bucket on Linux Systems using S3FS

Centos Clear Cache Memory

Like every operating system, Windows also stores different kinds of cache files on the hard drive. In simple words, cache files are temporary files that are stored on the memory to make it easier for you to access frequently used data. The cache data utilize lots of hard drive space of your computer. Deleting cache files is necessary for the smooth running of the system. Cache memory is responsible for various kinds of computer problems, including slow processing speed, slow startup, lag or hang, application responding, and many others. If you don't know how to clear memory cache on your Windows computer then, the solution to your problem is here. Here in this post, we will talk about How to clear memory cache on Windows computers.

5 Ways to Clear Memory Cache on Windows 10/8/7/Vista/XP

Memory

It is necessary to clear cache the memory to fully utilize your CPU power. Cache memory causes lots of problems by occupying a huge amount of computer RAM (Random Access Memory). That's why it is always recommended to clearing memory cache from your Windows computer to get optimum performance. Cache memory is something that is really useful to give you better performance. It helps the application to load faster as compared to load the app without cache data. Here below are some methods that will help you to clear memory cache in Windows 10/8/7/Vista/ and XP.

Linux Clear Memory Cache

Method 1: Create Clear Memory Cache Shortcut

This is one of the easiest solutions to clear memory cache on the Windows operating system. This method is completely free; you don't have to install any third-party paid tool to clear the memory cache. Below are some steps to clear memory cache on Windows.

Step 1: First of all, you have to turn on your computer and right-click on the desktop.

Step 2: Here, you will have a couple of options. Click on 'Shortcut' under the New option.

Step 3: Create a Shortcut wizard will appear, you have to click Browse to locate the directory. Or you can simply type '%windir%system32rundll32.exe advapi32.dll, ProcessIdleTasks' without quotes on the text field of 'Type the location of the item'.

Step 4: Once the above process is completed, you have to click on 'Next' button to proceed to the next step.

Step 5: Now, you have to type a name for this shortcut. Here, we are typing 'Clear Unused RAM' and hit on the 'Next' button.

Once the shortcut is created, switch to the desktop and double-click on the shortcut to clear memory cache on Windows.

Method 2: Clear General Cache

Disk Cleanup is an integrated feature of Microsoft Windows that enables the user to clean unwanted files. Getting engaging with this feature, you can remove temporary files, unwanted files, preview windows installation files, and much more. You just have to choose the disk and start the deleting process. Here below are steps to clear the memory cache using disk cleanup.

Step 1: At the first step, you have to click on the 'Start' button and type 'disk cleanup' in the search field and hit the 'Enter' button.

Centos Clear Cache Memory

Step 2: Now, Disk Cleanup: Drive Selection dialog box will appear. You have to choose the drive from where you would like to clear the memory cache.

Step 3: Now, click on the 'OK' button. It will start the scanning process and shows you how much space is occupied by the cache.

Step 4: You have to tick the checkbox which you would like to clean. If you want to clean system files then, you can click on the 'Clean up system files' otherwise, hit on the 'OK' button at the bottom of the window.

Step 5: Once the above process is completed, you can click on 'Delete Files' if prompted. It will start deleting cache files from places including recycling bin, Thumbnails, and many other places.

Method 3: Clear App Data File to Clear Memory Cache

Step 1: At the first step, you have to click on the 'Start' button or hit on the 'Windows' key and click on 'Computers' to open My Computer.

Step 2: My Computer window will appear; if you don't see My Computer, then manually type 'My Computer' in the start and hit the 'Enter' button.

Step 3: Once the above process is completed, you have to click on the 'Organize' tab in the top left corner of the window.

Step 4: Then, choose 'Folder and search options' under the organize drop-down menu.

Step 5: a Folder options dialog box will appear with 3 tabs; click on the view tab.

Step 6: Now, you have to click on 'Show Hidden files, folder, and drives' radio button under the 'Hidden files and folders'.

Step 7: Click on the 'OK' button at the button of the window.

Step 8: Once the above process is successfully completed, you have to open the hard disk where windows are installed.

Step 9: Now, you have to open the 'Users' folder by double-clicking on it. Then, click on the folder with an administrator account.

Step 10: You have to locate the 'AppData' folder and open it by double-clicking and open the 'Local' folder.

Step 11: Now, you have to select the 'Temp' folder and open it.

Step 12: Remove the read-only permissions from the Temp folder.

Step 13: You have to select all files that are placed in the Temp folder. You can press 'Ctrl' + 'A' to select all files.

Step 14: Once the files are selected, Press 'Shift' + 'Delete' button simultaneously to permanently delete all temp files.

Method 4: Delete Internet Explorer Files to Clear Memory Cache

Step 1: First of all, click on the 'Start' button and type 'Internet Explorer' in the text field and press the 'Enter' button.

Step 2: Internet Explorer web browser window will appear, you have to click on the 'General' tab at the top of the window.

Step 3: Now, you have to click on the 'Settings' under the browsing history section.

Step 4: Then, click on 'View files' at the screen's bottom right side. Once the above process is completed, a new window will appear with all cached files created by Internet Explorer.

Step 5: You have to press the 'Ctrl' + 'A' button simultaneously to select all the cache files.

Step 6: Now, you have to press the 'Shift' + 'Delete' button to remove all cached files permanently.

Method 5: Clear the DNS Cache

Step 1: Initially, you have to click on the 'Start' menu by clicking on the Start button at the bottom left of the screen.

Step 2: Now, type command prompt and hit the Enter button to launch. You can also open a command prompt by right click on Command prompt and run as administrator.

Step 3: On the command prompt, you have to type 'ipconfig /flushdns' without quotes and press the'Enter' button.

Clear Dns Cache Centos

Step 4: You have to wait for a couple of seconds and be notified when completed. Once it is successfully completed, you have to restart your computer to makes changes.

Product-related questions? Contact Our Support Team to Get Quick Solution >




Comments are closed.