Posts

Showing posts with the label cache

LRU Cache in Java

Image
Caches are often used as a cheap way to reduce latency and improve the performance of applications. Often we leverage libraries like Guava because they are rock solid and have lots of functionality but at the same time, all libs using Guava could easily bring a big jar hell and distributed monolith if you dont be cautious about your shared libraries. So if you are building a service might be completely fine to use more libs but as you build shared libs that could be really bad. So It's always precise and lean about your dependencies. So today I want to show that algorithms do not byte(much) and it's not rocket science to create a simple LRU Cache in Java using ZERO libraries. So I recorded a video going through the code and explaining what I did and how the algorithm works. For sure you could be thinking I prefer to use what's already there, sure thats fine. At the same time blotted applications and shared libs are really a nightmare at scale so somethings are better to cop...

Cache Distribuído com REST e EHCache Server no JBoss AS

Image
As aplicalções que desenvolvemos hoje são cada vez mais complexas, esta complexidade se deve a muitos fatores que vão des da globalização até mesmo as evolução da forma como as empresas fazem B2B e B2C . Muitas vezes o banco de dados acaba sendo um cargalo, uma vez que a sua rede esta 100% ok, uma forma viável de reduzir a carga no banco de dados é utilizar alguma forma de cache, se este cache tiver *hit*, ou seja, acertos em uma taxa considerável isso pode trazer muitas vantagens para a sua aplicação. Cache com EHCache EHCache é um solução open source de cache para Java. O EHCache lhe permite fazer vários tipos de cache como por exemplo aplicar cache junto ao Hibernate/JPA, cache de páginas web usando GZIP por exemplo e até mesmo cache distribuido que é o tema deste post. EHCache - Arquitetura Modular O EHCache tem uma arquitetura modular, logo você pode escolher os módulos que deseja utilizar. Neste post vou mostrar como trabalhar com o Cache Server. REST EHCache Serve...