RabbitMQ

Políticas de Cache

10 frequently caching implementations mistakes

"Getting an item from cache is not cheap" - Omar Al Zabir

Caching frequently used objects, that are expensive to fetch from the source, makes application perform faster under high load.

It helps scale an application under concurrent requests. But some hard to notice mistakes can lead the application to suffer under high load, let alone making it perform better, especially when you are using distributed caching where there’s separate cache server or cache application that stores the items.

Moreover, code that works fine using in-memory cache can fail when the cache is made out-of-process.

Here I will show you some common distributed caching mistakes that will help you make better decision when to cache and when not to cache.

Aqui vou mostrar alguns erros comuns de cache distribuída que irá ajudá-lo a fazer uma melhor decisão quando aplicar Cache e quando não aplicar armazenamento no Cache.

Lista de 10 erros típicos durante implementação de políticas de Cache:

  1. Relying on .NET’s default serializer. - Confiar totalmente no serializador padrão do .NET
  2. Storing large objects in a single cache item. - Gravar objetos extensos em um único item de Cache
  3. Using cache to share objects between threads. - Utlizar o Cache para compartilhar objetos em threads
  4. Assuming items will be in cache immediately after storing it.- Assumir que itens vão para o Cache tão logo são armazenados.
  5. Storing entire collection with nested objects. - Armazenamento da  coleção inteira com objetos aninhados.
  6. Storing parent-child objects together and also separately.- Armazenando objetos pai e filho juntos e também separadamente
  7. Caching Configuration settings.- Realizar Cache das Configurações, lendo do cache significa CPU overhead. Ao invés desta implementação, recomenda-se utilizar variavéis do tipo static para armazenar configurações.
  8. Caching Live Objects that has open handle to stream, file, registry, or network.- Cache de objetos "ativos" que se abrem para transmitir, arquivos, registry, ou network
  9. Storing same item using multiple keys.- Armazenar mesmo item utilizando multiplas chaves
  10. Not updating or deleting items in cache after updating or deleting them on persistent storage.- Não atualizar ou excluir itens em cache após atualizar ou excluí-los na camada persistente
DICAS PARA EVITAR DESGASTES ?
http://www.codeproject.com/KB/web-cache/cachingmistakes.aspx

Comments