In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Today, what the editor shares with you is the introduction of the cache module of the apache server, which many people do not know very well. Today, in order to let you know more about the cache module of the apache server, I have summarized the following contents for you. Let's look down together. I'm sure you'll get something.
Apache server cache
How apache server caching works (recommended Learning: Apache Server)
The above is a simple flowchart:
User 1 visits the A page, and the server parses the A page and returns it to user 1. At the same time, it does some mapping on the server memory to cache the A page on the hard disk.
User 2 visits the A page, and the server finds the corresponding page cache directly according to the mapping on memory and returns it directly to user 2, which reduces the repeated parsing of the same page by the server.
The difference between server cache and browser cache:
The server cache caches the page to the hard disk on the server, while the browser cache caches the page to the user's own computer.
Open the mod_file_cache module to cache static files
The act of opening a file is itself a cause of delay, especially opening files in the network file system.
Apache can avoid this delay by maintaining a buffer that holds file descriptors for highly used files. Rarely changed files, which are often requested, are cached, which is a technique to reduce server load.
Mod_file_cache provides two techniques to cache frequently requested static files.
The most basic way for buffering files (CacheFile) to exist in Apache is the file handle (file-handle) buffering implemented by mod_file_cache. Rather than caching the contents of the file itself, this buffer maintains an open table of file descriptors that holds the file handle to the file specified in the configuration file using the CacheFile directive.
The CacheFile directive instructs Apache to open a file at startup and reuse the file handle for all subsequent accesses to the file.
/ / sample CacheFile/usr/local/apache2/htdocs/index.html
If you plan to cache a large number of file handles in this way, you must make sure that the operating system has an adequate limit on the number of files opened at the same time.
Although using CacheFile will not cause the contents of the file to be cached, it will cause all changes to the file to not take effect while Apache is running. The contents of the files used to provide the service will remain the same since Apache was started. If the file is deleted while Apache is running
Open the mod_cache module to cache dynamic files
Mod_cache has two storage management modules:
Mod_disk_cache, a disk-based storage management module.
Mod_mem_cache, a memory-based storage management module.
Mod_mem_cache can be configured to operate in two different modes: ① caches open file descriptors and ② caches objects on the heap.
Mod_mem_cache can be used both to cache locally generated content and to cache back-end server output for mod_proxy in reverse proxy mode (see ProxyPass).
Mod_mem_cache: memory-based caching that provides services directly from the system's memory is usually the fastest way to get service content. Reading files from a disk controller, or worse, from a remote network, is several orders of magnitude slower.
Disk controllers usually involve physical actions, access to the network is limited to network bandwidth, while access to memory usually takes only a few nanoseconds. Memory is probably the most expensive memory per byte at present, and it is important to ensure that it works fully.
Caching files in memory will result in a reduction in available memory on the system. As we will see, this is not a big problem in the case of memory buffers in the operating system.
But when using Apache's own memory buffer, it is important to make sure that too much memory is not allocated for the buffer. Otherwise, the operating system will use swap (virtual memory / swap area), which may lead to a sharp performance degradation. The operating system buffers almost all modern fuck
Content caching of Apache server
Since Apache2.2, two caching modules have been officially used: mod_cache and mod_file_cache. These buffering systems provide a powerful way to accelerate the HTTP processing speed of the original web server (originwebserver) and proxy server (proxy).
The official manual explains the difference between mod_cache and mod_file_cache: the implementation of mod_cache caching depends on two modules, mod_mem_cache and mod_disk_cache, which provide intelligent HTTP buffering.
The content itself is stored in a buffer, and the purpose of the mod_cache is to manage the various HTTP headers and options that control the buffering capacity of the content. It can handle both local content and proxy content.
Mod_cache is designed for both simple and complex buffering configurations to handle agent content, dynamic local content, and local files that must be accessed faster and change over time.
Read how to open the mod_cache module. Mod_file_cache implements a more basic, but in some cases more efficient form of buffering, which avoids the maintenance complexity required to proactively ensure URL buffering capabilities, and mod_file_cache maintains a file buffer since Apache was last started by providing file handles (file-handle) and memory mapping (memory-mapping).
These are the details of the cache module of the apache server. Have you gained anything after reading it? If you want to know more, welcome to the industry information!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.