Memcached on windows server

Содержание
  1. Memcached on windows server
  2. A) Installation of memcached c:\memcached\memcached.exe with the actual path of your installation. Then, start or stop the memcached service with the following command: To change the configuration of memcached, run regedit.exe and navigate to the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached . Suppose you wish to increase the memory limit of memcached, edit the value of ImagePath to the following: Besides -m 512 , you may also append other memcached parameters to the path. Run c:\memcached\memcached.exe -h to view the list of available parameters. Meanwhile, to uninstall the memcached serivce, run the following command: B) Installation of memcached >= 1.4.5: Extract the memcached windows binary to any directory. In version 1.4.5 or later, memcached cannot run as a service. It must be started as a normal process using the task scheduler. To configure the memcached process to run automatically every time windows start, run a command prompt with elevated privileges, and type the following: Replace c:\memcached\memcached.exe with the actual path of your installation. Besides -m 512 , you may also append other memcached parameters to the path. Run c:\memcached\memcached.exe -h to view the list of available parameters. Meanwhile, to remove the scheduled memcached task, run the following command: Integrating with PHP To interface with memcached in PHP, you need to install the memcache extension for PHP: Check that your PHP extension folder has the file php_memcache.dll. If not, download the file from https://pecl.php.net/package/memcache (select the windows dll file), and place it in the PHP extension folder. Add the following line in php.ini to enable the memcache extension: extension=php_memcache.dll Create this simple php script file to test that it works. Integrating with Python To interface with memcached in Python, you need to install the memcached client for Python. Execute one of the following command to install the memcached client. The first is for Python 2.x while the second is for Python 3.x. Create this simple python script to test that it works. Memcached statistics To view the statistics for memcached, bring up a telnet connection to memcached by the command: Then, type stats and enter. Here is an explanation of the different memcached stats. How to Install Memcached Server on Windows as Service In my earlier post, I explained how to install Memcached server on Mac OS. Today I will explain how to install the Memcached server on Windows operating system. Table of Contents Install Memcached on Windows To install the Memcached Server on Windows, we have to run its “exe” or “batch” process file. However, the Memcached server was written for Unix/Linux based operating system and you can’t get a Windows version from the Memcached server official website. This problem is solved by Jellycan Code and NorthScale. They provided the Win32 and Win64 versions in a binary format that can be used to install the Memcached server on Windows. Steps to install Memcached on Windows Download memcached installer zip from the following links based on your Windows setup – Win32, Win64. Unzip it in some hard drive folder. For example C:\memcached There will be memcached.exe file in the unzipped folder. Open Command Prompt and execute below commands to install it as service and start it. Now Memcached is installed and running as a daemon process on port 11211. You can view it in the Control Panel Services also and stop and start it from there. You can run memcached.exe -help command to check all the available options like changing ports. Once you have started memcached server, you can use memcached telnet commands or memcached java client program to test it. Установка memcached под Windows 7 Memcached разработан для кэширования данных, генерация которых требует большого количества ресурсов. Такого рода данные могут содержать что угодно, начиная с результатов запроса к базе данных и заканчивая тяжеловесным куском шаблона. Для начала скачиваем сам сервер memecached. Распаковываем архив memcached-1.2.6-win32-bin.zip, кладем файл memcached.exe в директорию C:/Program Files/memcached/. Устанавливаем как сервис (cmd запускаем от имени администратора): Краткую справку по memcached можно получить с помощью ключа -help: Если при установке появляется ошибка «отсутствует MSVCR71.dll», то можно прочесть статью, где описывается способ борьбы с ней. Если коротко — надо скачать две dll бибилиотеки и скопировать их в папку C:/Windows/System32. Запускаем сервер: Панель управления->Администрирование->Службы. Выбираем memcached Server, кликаем «Запустить службу». Также можно поставить тип запуска «Авто», чтобы сервер автоматически стартовал при загрузке системы. Теперь нам нужен клиент для работы с сервером. Здесь есть выбор: memcache и memcached. Под Windows мне удалось найти только расширение php_memcache.dll (для версии PHP 5.3), которое можно скачать здесь. Распаковываем php_memcache-2.2.6-5.3-vc9-x86.zip, кладем файл php_memcache.dll в директорию с расширениями PHP. У меня это C:/Program Files/php/ext. В php.ini прописываем: Теперь остается создать скрипт с функцией phpinfo(). Запускаем этот скрипт и ищем на странице секцию Memcache. Если секция найдена, то memcache установлен и готов к работе: Установка memcached на VPS memcached — программное обеспечение, с помощью которого происходит временное кэширование в оперативной памяти сервера. Оно позволяет ощутимо ускорить работоспособность сайта. Чтобы установить memcached, выберите вашу ОС: На данном этапе установка завершена. Чтобы проверить, запущен ли memcached, введите команду: netstat -tap | grep memcached Терминал выдаст результат с запущенным процессом memcached Перезапустите веб-сервер Apache: service httpd restart Установка memcached завершена. Чтобы проверить, включен ли memcached, введите команду: netstat -tap | grep memcached Терминал выдаст результат с запущенным процессом memcached Для установки расширения memcached на PHP: В разделе Настройки web-сервера выберите пункт PHP: Выберите нужную версию PHP и нажмите кнопку Расширения: В списке доступных расширений найдите memcache. Чтобы включить его, нажмите на иконку Лампочка: Memcached на CMS Если вы используете CMS для вашего сайта (WordPress, Joomla, Bitrix, Drupal), для корректной работы кэширования необходимо добавить и настроить плагин memcached. Для Joomla 3: В разделе Общие настройки на вкладке Система выберите Обработчик кэширования Memcache. Закажите сервер с чистой CentOS или панелью управления ISPmanager всего за пару минут. Memcached with Windows and .NET Is there anyone already implement memcached for production use in Windows environment? Because many blogs that I’ve read, it’s not recommended to run memcached in Windows especially for production use, for example running memcached on windows. And one more thing, which memcached client that is good to use with c# and .net 3.5 ? I’ve found many alternate such as Memcached Providers @ Codeplex, Beitmemcached, and memcached provider @ Sourceforge 11 Answers 11 Why do you need to run memcached on windows? It’s an expensive affair in a production environment. If your code needs to run in a Windows environment get a windows memcached client and talk to a *nix based memcached machine. In a production environment running memcached on Server 2003 or 2008 would mean that you get licenses for all those boxes. Linux will offer you all the OSS benefits. TCO will rise linearly with memcached on Windows Edit: It’s been around 1.5 years since I wrote this answer and lot of things have changed since. You’ve to take notice, especially when someone like Dustin comments. So here’s how you can get memcached on windows running. Download memcached for windows from Couchbase (formerly Northscale). Typically if you plan to run memcached on the same production machine you’d want to start it in limited memory, i.e. define the maximum memory memcached is allowed to use. c:\Program Files\memcached>memcached.exe -m 128. Here memcached runs with a maximum of 128 mb usage. You don’t want memcached to take up all the memory on your webserver. The moment you decided to scale out memcached you’ll need to consider what I said earlier. Additionally compress your values in the key value combinations. Web servers typically consume very little CPU (2-3%) usage and compression brings in a lot of value to network throughout in comparison to the CPU usage. If you are too concerned about normal compression, try LZO I’m suprised no one here has yet to mention Redis — it is one of the most feature-rich and fastest (110,000 SET’s per second on an entry level linux box) key-value data stores with rich data-structure support for strings, sets, lists, sorted sets and hashes. Although windows is not an officially supported platform, it runs perfectly under windows with all tests passing. I have windows builds (using Cygwin) available here: https://github.com/ServiceStack/ServiceStack.Redis#redis-server-builds-for-windows It also has client bindings for nearly every programming language in use today. I maintain a rich Open Source C# Redis client with native API support for any C# POCO type, transaction support and Thread-safe client managers that are ready to be dropped into any IOC at: https://github.com/ServiceStack/ServiceStack.Redis Since Velocity didn’t exist at the time, I used a memcached port to Windows for the company that I work for, Skiviez. It mainly only exists to provide a centralized cache for multiple worker processes on the same machine. It’s been running fine about 18 months now on an e-commerce site that sees modest use ( 18,500 hits/day). The client that I used was Enyim integrated as a cache provider for iBATIS.NET. That client seems to work well enough; memcached clients are not very complicated to begin with, either. If I had to do it again, I’d probably look at Velocity if I was committed to remaining on Windows for my distributed caching solution. But it’s working now, so I’m not going to touch it. (Aside: Since then, I negated most of the need for the cache by adding certain Cache* columns to key tables in the database that are updated by a scheduled task every evening. This ended up putting much less strain on resources all around, from the initial hit in CPU time by querying the database to the subsequential strain on memory availability by keeping the cached results sitting in memcached. It also made it much more explicit in the code when a cached version of the data is being accessed versus a calculated-on-the-fly version. I’m sure you have lots of reasons to use a distributed cache, but it’s always worth a shot to take a step back and question whether or not you really need it!)
  3. B) Installation of memcached >= 1.4.5:
  4. Integrating with PHP
  5. Integrating with Python
  6. Memcached statistics
  7. How to Install Memcached Server on Windows as Service
  8. Install Memcached on Windows
  9. Steps to install Memcached on Windows
  10. Установка memcached под Windows 7
  11. Установка memcached на VPS
  12. Чтобы установить memcached, выберите вашу ОС:
  13. Для установки расширения memcached на PHP:
  14. Memcached на CMS
  15. Memcached with Windows and .NET
  16. 11 Answers 11
Читайте также:  Диспетчер задач не показывает сеть windows 10

Memcached on windows server

Memcached is a high performance, in-memory key-value store or caching system. Its main purpose is to speed up web applications by caching database queries, contents, or other computed results.

Memcached is originally a linux application, but since it is open-source, it has been compiled for windows. There are two major sources for the pre-built windows binary: Jellycan and Northscale, and both versions can be used. The following are the download links for the memcached windows binaries:

In versions earlier than 1.4.5, memcached can install itself as a service. However, the ability to run memcached as a service is removed since version 1.4.5. Therefore, the installation steps are divided into two categories, part A for memcached prior to version 1.4.5. and part B for memcached version 1.4.5 and later.

A) Installation of memcached c:\memcached\memcached.exe with the actual path of your installation.

Then, start or stop the memcached service with the following command:

To change the configuration of memcached, run regedit.exe and navigate to the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached . Suppose you wish to increase the memory limit of memcached, edit the value of ImagePath to the following:

  • Besides -m 512 , you may also append other memcached parameters to the path. Run c:\memcached\memcached.exe -h to view the list of available parameters.

Meanwhile, to uninstall the memcached serivce, run the following command:

B) Installation of memcached >= 1.4.5:

Extract the memcached windows binary to any directory.

In version 1.4.5 or later, memcached cannot run as a service. It must be started as a normal process using the task scheduler. To configure the memcached process to run automatically every time windows start, run a command prompt with elevated privileges, and type the following:

  • Replace c:\memcached\memcached.exe with the actual path of your installation.
  • Besides -m 512 , you may also append other memcached parameters to the path. Run c:\memcached\memcached.exe -h to view the list of available parameters.

Meanwhile, to remove the scheduled memcached task, run the following command:

Integrating with PHP

To interface with memcached in PHP, you need to install the memcache extension for PHP:

Check that your PHP extension folder has the file php_memcache.dll. If not, download the file from https://pecl.php.net/package/memcache (select the windows dll file), and place it in the PHP extension folder.

Add the following line in php.ini to enable the memcache extension: extension=php_memcache.dll

Create this simple php script file to test that it works.

Integrating with Python

To interface with memcached in Python, you need to install the memcached client for Python.

Execute one of the following command to install the memcached client. The first is for Python 2.x while the second is for Python 3.x.

Create this simple python script to test that it works.

Memcached statistics

To view the statistics for memcached, bring up a telnet connection to memcached by the command:

Then, type stats and enter.

Here is an explanation of the different memcached stats.

How to Install Memcached Server on Windows as Service

In my earlier post, I explained how to install Memcached server on Mac OS. Today I will explain how to install the Memcached server on Windows operating system.

Table of Contents

Install Memcached on Windows

To install the Memcached Server on Windows, we have to run its “exe” or “batch” process file.

However, the Memcached server was written for Unix/Linux based operating system and you can’t get a Windows version from the Memcached server official website.

This problem is solved by Jellycan Code and NorthScale. They provided the Win32 and Win64 versions in a binary format that can be used to install the Memcached server on Windows.

Steps to install Memcached on Windows

  1. Download memcached installer zip from the following links based on your Windows setup – Win32, Win64.
  2. Unzip it in some hard drive folder. For example C:\memcached
  3. There will be memcached.exe file in the unzipped folder.
  4. Open Command Prompt and execute below commands to install it as service and start it.

Now Memcached is installed and running as a daemon process on port 11211. You can view it in the Control Panel Services also and stop and start it from there.

You can run memcached.exe -help command to check all the available options like changing ports.

Once you have started memcached server, you can use memcached telnet commands or memcached java client program to test it.

Установка memcached под Windows 7

Memcached разработан для кэширования данных, генерация которых требует большого количества ресурсов. Такого рода данные могут содержать что угодно, начиная с результатов запроса к базе данных и заканчивая тяжеловесным куском шаблона.

Для начала скачиваем сам сервер memecached. Распаковываем архив memcached-1.2.6-win32-bin.zip, кладем файл memcached.exe в директорию C:/Program Files/memcached/. Устанавливаем как сервис (cmd запускаем от имени администратора):

Краткую справку по memcached можно получить с помощью ключа -help:

Если при установке появляется ошибка «отсутствует MSVCR71.dll», то можно прочесть статью, где описывается способ борьбы с ней. Если коротко — надо скачать две dll бибилиотеки и скопировать их в папку C:/Windows/System32.

Запускаем сервер: Панель управления->Администрирование->Службы. Выбираем memcached Server, кликаем «Запустить службу». Также можно поставить тип запуска «Авто», чтобы сервер автоматически стартовал при загрузке системы.

Теперь нам нужен клиент для работы с сервером. Здесь есть выбор: memcache и memcached. Под Windows мне удалось найти только расширение php_memcache.dll (для версии PHP 5.3), которое можно скачать здесь. Распаковываем php_memcache-2.2.6-5.3-vc9-x86.zip, кладем файл php_memcache.dll в директорию с расширениями PHP. У меня это C:/Program Files/php/ext. В php.ini прописываем:

Теперь остается создать скрипт с функцией phpinfo(). Запускаем этот скрипт и ищем на странице секцию Memcache. Если секция найдена, то memcache установлен и готов к работе:

Установка memcached на VPS

memcached — программное обеспечение, с помощью которого происходит временное кэширование в оперативной памяти сервера. Оно позволяет ощутимо ускорить работоспособность сайта.

Чтобы установить memcached, выберите вашу ОС:

На данном этапе установка завершена. Чтобы проверить, запущен ли memcached, введите команду: netstat -tap | grep memcached

Терминал выдаст результат с запущенным процессом memcached

Перезапустите веб-сервер Apache: service httpd restart

Установка memcached завершена. Чтобы проверить, включен ли memcached, введите команду: netstat -tap | grep memcached

Терминал выдаст результат с запущенным процессом memcached

Для установки расширения memcached на PHP:

В разделе Настройки web-сервера выберите пункт PHP:

Выберите нужную версию PHP и нажмите кнопку Расширения:

В списке доступных расширений найдите memcache. Чтобы включить его, нажмите на иконку Лампочка:

Memcached на CMS

Если вы используете CMS для вашего сайта (WordPress, Joomla, Bitrix, Drupal), для корректной работы кэширования необходимо добавить и настроить плагин memcached.

Для Joomla 3: В разделе Общие настройки на вкладке Система выберите Обработчик кэширования Memcache.

Закажите сервер с чистой CentOS или панелью управления ISPmanager всего за пару минут.

Memcached with Windows and .NET

Is there anyone already implement memcached for production use in Windows environment? Because many blogs that I’ve read, it’s not recommended to run memcached in Windows especially for production use, for example running memcached on windows.

And one more thing, which memcached client that is good to use with c# and .net 3.5 ? I’ve found many alternate such as Memcached Providers @ Codeplex, Beitmemcached, and memcached provider @ Sourceforge

11 Answers 11

Why do you need to run memcached on windows? It’s an expensive affair in a production environment.

If your code needs to run in a Windows environment get a windows memcached client and talk to a *nix based memcached machine.

In a production environment running memcached on Server 2003 or 2008 would mean that you get licenses for all those boxes. Linux will offer you all the OSS benefits. TCO will rise linearly with memcached on Windows

Edit:

It’s been around 1.5 years since I wrote this answer and lot of things have changed since. You’ve to take notice, especially when someone like Dustin comments.
So here’s how you can get memcached on windows running. Download memcached for windows from Couchbase (formerly Northscale).
Typically if you plan to run memcached on the same production machine you’d want to start it in limited memory, i.e. define the maximum memory memcached is allowed to use.

c:\Program Files\memcached>memcached.exe -m 128.

Here memcached runs with a maximum of 128 mb usage. You don’t want memcached to take up all the memory on your webserver.

The moment you decided to scale out memcached you’ll need to consider what I said earlier. Additionally compress your values in the key value combinations. Web servers typically consume very little CPU (2-3%) usage and compression brings in a lot of value to network throughout in comparison to the CPU usage. If you are too concerned about normal compression, try LZO

I’m suprised no one here has yet to mention Redis — it is one of the most feature-rich and fastest (110,000 SET’s per second on an entry level linux box) key-value data stores with rich data-structure support for strings, sets, lists, sorted sets and hashes.

Although windows is not an officially supported platform, it runs perfectly under windows with all tests passing. I have windows builds (using Cygwin) available here: https://github.com/ServiceStack/ServiceStack.Redis#redis-server-builds-for-windows

It also has client bindings for nearly every programming language in use today. I maintain a rich Open Source C# Redis client with native API support for any C# POCO type, transaction support and Thread-safe client managers that are ready to be dropped into any IOC at: https://github.com/ServiceStack/ServiceStack.Redis

Since Velocity didn’t exist at the time, I used a memcached port to Windows for the company that I work for, Skiviez. It mainly only exists to provide a centralized cache for multiple worker processes on the same machine. It’s been running fine about 18 months now on an e-commerce site that sees modest use (

18,500 hits/day). The client that I used was Enyim integrated as a cache provider for iBATIS.NET. That client seems to work well enough; memcached clients are not very complicated to begin with, either.

If I had to do it again, I’d probably look at Velocity if I was committed to remaining on Windows for my distributed caching solution. But it’s working now, so I’m not going to touch it.

(Aside: Since then, I negated most of the need for the cache by adding certain Cache* columns to key tables in the database that are updated by a scheduled task every evening. This ended up putting much less strain on resources all around, from the initial hit in CPU time by querying the database to the subsequential strain on memory availability by keeping the cached results sitting in memcached. It also made it much more explicit in the code when a cached version of the data is being accessed versus a calculated-on-the-fly version. I’m sure you have lots of reasons to use a distributed cache, but it’s always worth a shot to take a step back and question whether or not you really need it!)

Оцените статью