mercredi 12 juin 2013

Créer un pool de connexion Olap avec Olap4J et DBCP

Olap4J est un projet qui a (entre autre) pour but d'exposer les connexions et les requètes Olap comme des requêtes JDBC. Cela présente beaucoup d'avantage comme par exemple le fait de se retrouver avec des api que l'on connait déjà bien ou de pouvoir utiliser les efforts déjà fait sur les pool de connexion comme C3P0 ou common DBCP.

J'ai rencontré quelques difficultés en utilisant DBCP 1.2.1, et vous devrez pour des raisons de "legacy" souvent travailler avec cette version de la librairie. A la suite je présente le code que l'on pourrait utiliser avec dbcp 1.4


Getting the number of weeks in a year

mardi 4 juin 2013

Why using memcached instead of a local cache solution

I decide to have a look to memcached and see what  it is all about. I found this small self-explenatory story in their wiki. I finally understood that memcached let you use the ram of other servers in your network. Actually you query this distributed cache through TCP-IP



Memcached has an algorithm that choose the server based on the key input.

But it supposes you buy new servers, connect them to your network. And if you need to increase your cache to, let's say 1 Gb, you need to buy a new server ! This caching solution look expensive to me and do not compete with a local cache. It is true that accessing data in the RAM is much faster than accessing data on a local storage, but there is the overhead of the TCP connections.. ...

On his blog  Artur Ejmond compares APC (Which is a local cache solution) and memcached. The result is clear APC is much faster and much cheaper.


Then why using memcached instead of a local cache solution ?

I can see two reasons  :

  1. You have more than one client for the cache and you want all of them to share the same cache
  2. Theres's a lot of write on the cache and your disk risk to bottleneck
I know that many major sites like wikipedia or twitter use memcached, but I would be happy to hear why you choose memcached over a local cache solution.