Bobcares

Configure Memcached on Your VPS: How to?

by | May 15, 2023

Let us take learn how to Configure Memcached on Your VPS with the support of our WordPress support services at Bobcares.

Why Configure Memcached on Your VPS?

Configure Memcached on Your VPS

Memcached is a simple yet effective memory caching solution. Hosting providers and server administrators frequently utilize it to cache database data, page rendering chunks, API requests, and a variety of other things.

As a result, there is a noticeable performance increase, particularly in dynamic apps and web pages.

Through the Memcached APIs, you may have a very big hash table and distribute it over numerous servers. When that table reaches its capacity, it will remove old cached data, starting with the least recently utilized records.

Memcached was created in Perl and first made public in 2003. It has now been rewritten to make it more flexible to diverse systems. Memcached is now integrated into many of the world’s largest and most popular websites, including Facebook, Twitter, YouTube, Wikipedia, Reddit, and others.

Setting up Memcached in cPanel

Memcached was created in Perl and first made public in 2003. It has now been rewritten to make it more flexible to diverse systems.

Memcached can setup in into many of the world’s largest and most popular websites, including Facebook, Twitter, YouTube, Wikipedia, Reddit, and others.

Log in to the computer using the preferred SSH client. Install the daemon by going to:

yum install memcached

We must additionally register Memcached with the service manager in order to regulate how it runs. In a CentOS environment, the command would be:

systemctl enable memcached

After the setup process we have to update the security setup as well.

How to Secure the Memcached Configuration?

Memcached has no built-in security protections and leaves connections accessible to everyone.

This might lead to a slew of problems and online assaults (such as a DDoS) in the future. There are several simple techniques for fortifying the defenses.

To begin, we may open the Memcached configuration file in a text editor of our choosing. We should include it in:

/etc/sysconfig/memcached

Once inside, change the last line to read:

OPTIONS=”-l 127.0.0.1 -U 0″

This disables UDP and restricts Memcached to the local network alone.

We may also look at the CACHESIZE. This parameter instructs the server on how much memory to devote to caching processes. Many hosts leave the default at 64 MB, which should increase to at least 128 MB:

CACHESIZE=”128″
To make the modifications take effect, we must restart the daemon:

systemctl restart Memcached

ScalaHosting sets the CACHESIZE limit to 512 MB by default. This ensures that enough of RAM is always available for caching on our cloud VPS services.

Configuring Memcached in SPanel

If we are a ScalaHosting customer with one of the SPanel VPS plans, Memcached is setup and waiting for us. Furthermore, if we want to adjust things like the default CACHESIZE or raise any other limitations, our tech support staff will happily assist and save us time.

We merely need to submit a ticket through the Client Area, and our expert personnel will handle any settings for us.

Installing Memcached PHP Extensions

Because PHP does not natively support Memcached, you’ll need certain extensions to connect them.

The first step is to verify your PHP version, which will help us identify the correct Memcached version. If we have many PHP instances running, we must specify the caching solution for each one.

Memcached and Memcache are two solutions with rather misleading names. The latter is effectively the Memcached daemon’s PHP extension.

install Memcache extension via WHM

Here’s how to install the Memcache extension with WHM:

  1. Enter the Web Host Manager.
  2. Click on EasyApache 4 in the Software section on the left menu.
  3. This will bring up the Currently Installed Packages option. Click the blue Customize button to the right of it.
  4. There will be a slew of sub-menus – PHP extensions.
  5. Enable the Install options for Memcache versions.
  6. Then, at the bottom of the screen, pick the Review tab and click the Provisions button.

The given PHP extensions and their dependencies will setup after a brief delay. Now we can use the SSH client to restart Memcached on the VPS:

systemctl restart memcached

That should do the work, and we’ll be able to experience quicker apps thanks to Memcached.

In the future, we can always run the following command to get relevant caching statistics:

memcached-tool 127.0.0.1:11211 stats

Now we must connect the chosen PHP applications to memached appropriately.

Setting up the PHP Apps for Memcached

The procedure of integrating Memcached with a PHP program is very dependent on the software we choose.

Here are some of the top CMS plug-ins for the most common platforms:

  • WordPress – W3 Total Cache, Cachify, Cache Master, and more.
  • Joomla – comes with native Memcached support. Activate through the config file.
  • Magento – comes with native Memcached support.
  • Drupal – Memcache API and Integration module.

[Need assistance with similar queries? We are here to help]

Conclusion

To sum up we have now seen how to Configure Memcached on Your VPS with the support of our tech support team.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF