大网数据广告活动
服务器运维问答

Can I use apache2 and memcache in same server?

· 52CE 我爱测

I am really new to server development. I have a server ( Server version: Apache/2.4.41 (Ubuntu) ) for Django and it's running on apache2. I want to use Memcache for a large queryset. I just wanna use the following Django future: …

问题原文

原帖链接 · Murat Demir · CC BY-SA 4.0

I am really new to server development. I have a server (Server version: Apache/2.4.41 (Ubuntu)) for Django and it's running on apache2. I want to use Memcache for a large queryset. I just wanna use the following Django future:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
        'LOCATION': '127.0.0.1:11211',
    }
}

As I understand with the documentations I have to install Memcached, configure, and start at systemctl. As I mention before I have an apache2 server on systemctl. If I will install Memcached with sudo apt install memcached, is it going to be a problem?

I am really scaring to install something on the server because we have almost 20 projects running on apache2 and I don't want to ruin it. I try to use apache2 and nginx at the same time in the past and it causes big problems.

Which way should I follow to use memcached?. Do I have to buy a new server?

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

Yes, you can run memcached on the same server safely, if you have enough free memory available to store whatever data it will cache.

The purpose of memcached is to keep some data in memory so that it can be accessed more quickly than by loading it from disk repeatedly. That means that memory will be unavailable for other purposes while it is being used for caching your application data.

You should have some idea of how much memory will be needed. If you do not already know, you can run tests in your test environment. Because you mention a large queryset, you probably already know approximately how much memory this will need.

After you know approximately how much memory you need, you can decide if your server already has enough memory, or if you need to add more memory (or use another server).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-07-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。