1.Memcached 中文文档 - 概论(译官方文档)

原文地址:memcached手册     https://github.com/memcached/memcached/wiki/Overview

简介

Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

免费,开源,高性能,分布式对象缓存数据库,一般在业界中,它的目的是通过减轻数据库负载来加速动态web应用程序。

Memcached is an in-memory key-value store for small arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.

Memcached是一种基于内存的key-value存储,用来存储小块的任意数据(字符串、对象)。这些数据可以是数据库调用、API调用或者是页面渲染的结果。

Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.

Memcached简洁而强大。它的简洁设计便于快速开发,减轻开发难度,解决了大数据量缓存的很多问题。它的API兼容大部分流行的开发语言。

工作原理

Memcached is a developer tool, not a “code accelerator”, nor is it database middleware. If you’re trying to set up an application you have downloaded or purchased to use memcached, read your app’s documentation. This wiki and community will not be able to help you.

Memcached是一种开发工具,而不是“代码加速器”,也不是数据库中间件。如果你试图建立一个你已经下载或购买的应用程序来使用memcached,请阅读你的应用程序的文档。这个文档和社区将无法帮助你。

组成部分

  • Client software, which is given a list of available memcached servers.
  • A client-based hashing algorithm, which chooses a server based on the “key”.
  • Server software, which stores values with their keys into an internal hash table.

LRU, which determine when to throw out old data (if out of memory), or reuse memory.

Design Philosophy  设计理念

Simple Key/Value Store    简单的键/值 存储

The server does not care what your data looks like. Items are made up of a key, an expiration time, optional flags, and raw data. It does not understand data structures; you must upload data that is pre-serialized. Some commands (incr/decr) may operate on the underlying data, but in a simple manner.

Memcached不关心你的数据是什么。items由一个key,一个过期时间,可选择的标记,还有一个数据。它不了解数据结构,所以你必须提交一个已经序列化的数据给它。一些命令(incr/decr)可以用简单的方式对底层数据进行操作。 

Logic Half in Client, Half in Server   逻辑处理一半在客户端,一半在服务器

A “memcached implementation” is partially in a client, and partially in a server. Clients understand how to choose which server to read or write to for an item, what to do when it cannot contact a server.

memcached的实现,部分在客户端,部分在服务器。客户端知道如何选择要为项目读取或写入的服务器,以及在无法联系服务器时要执行的操作。

The servers understand how store and fetch items. They also manage when to evict or reuse memory.

服务器了解如何存储和获取数据。 他们也可以从内存中移除数据或者复用数据。

Servers are Disconnected From Each Other 服务器彼此之间是无连接的

Memcached servers are unaware of each other. There is no crosstalk, no syncronization, no broadcasting, no replication. Adding servers increases the available memory. Cache invalidation is simplified, as clients delete or overwrite data on the server which owns it directly.

Memcached服务器彼此之间是无联系的。它们之间没有串扰,没有同步,没有广播,没有复制。添加服务器,就会增加可用内存。让缓存失效的操作很简单,你可以让客户端删除这条记录或者覆盖服务器上面的数据。

O(1)  最低的时空复杂度

All commands are implemented to be as fast and lock-friendly as possible. This gives allows near-deterministic query speeds for all use cases.

全部的命令实现起来都是非常快的并且对锁尽可能的友好。对查询速度速度也是非常快的。

Queries on slow machines should run in well under 1ms. High end servers can serve millions of keys per second in throughput.

慢速机器上的查询应该在1ms以下运行。 高端服务器的吞吐量可以达到每秒数百万个密钥。

Forgetting is a Feature  缓存过期

Memcached is, by default, a Least Recently Used cache. Items expire after a specified amount of time. Both of these are elegant solutions to many problems; Expire items after a minute to limit stale data being returned, or flush unused data in an effort to retain frequently requested information.

 数据在指定的时间后过期。 这些都是许多问题的优雅解决方案; 一分钟后过期数据以限制返回的陈旧数据,或将缓存中未使用的数据替换为经常请求的信息数据。

Cache Invalidation  缓存失效

Rather than broadcasting changes to all available hosts, clients directly address the server holding the data to be invalidated

客户机不直接向所有可用主机广播更改,而是直接向服务器保存数据,以使其失效。

 

    原文作者:memcached
    原文地址: https://www.cnblogs.com/jingying/p/9456653.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞