In-memory caching on the server

I want to write a web application with client Javascript and an internal server (Python). The client often needs data from the server via AJAX. Data in the database and expensive to download for each request.

However, in a desktop application, I simply load data from the database once into memory, and then gain access to it. In a web application - the server code is run every time for a request, so I can’t do this (each launch must again be loaded from the database into memory). How can this work? Can one process run on the server or do I need to use something else here?

An example is similar to autocomplete here in stackoverflow for tags - how is it implemented on the server for fast caching / loading?


I wonder if a data warehouse such as memcached is a good approach to autocomplete? How do you present keys for partial matches?

+5
source share
5 answers

Using memcache or a similar tool

Each item in the cache has a key and an expiration date and time.

You need to make the key useful for your application. Typical Security.Domain.Query.QueryValue model template for collections or Security.Domain.ID for individual objects

eg.

ALL.Product.Q.Red is a collection from the Products domain using a Red query for all users

Admin.Product.Q.Blu - Products, Blu Admin

ALL.Customer.O.12345 - 12345 .

, .

- , -, , memcache, ,

. ,

, memcache . ( "." )

+6

memcached.

0

, , memcache ( ). ( ). (Facebook memcache).

0

, twisted, , . , , , , , - . , , , . http://twistedmatrix.com/ - .

0

Redis (http://code.google.com/p/redis/)

:

Redis - . memcached, , , , memcached, , . / , / , , , .. Redis .

Redis !, 110000 SETs/second, 81000 GETs/second Linux .

0

All Articles