Page 1 of 1

Best approach for data extraction (RESTfull API vs DB read)

Posted: Tue May 14, 2013 4:57 am
by dlavoie
Hi,

I've seen that BLC is using EHCache. This makes me wonder if hot data extraction from the database is secure. If I want clean read, is it better to rely on the RESTfull API or database read is always in synch with the cache's state ?

Thanks all of for your time.

Regards,
dlavoie@cspinformatique.com
Daniel Lavoie

Re: Best approach for data extraction (RESTfull API vs DB read)

Posted: Tue May 14, 2013 8:30 am
by ktisdell
The database should always be considered correct. EHCache, theoretically, can be out of synch with the database, since another application or app server node could have updated the database, where others are reading from cache. Of course, having your cache setting tuned properly can help mitigate issues with this. But, to answer your question, reading data from the database is always safest.

Re: Best approach for data extraction (RESTfull API vs DB read)

Posted: Tue May 14, 2013 10:15 am
by dlavoie
Thank you for your explanations Ktisdell.

I wasn't sure of how BLC implemented EHCache. With your explanation is seems clear now that the database is updated first and then the cache refreshed. I admit I've been lazy, I could have opened the source and look by myself.

Have a good day !

Regards,
Daniel Lavoie