[erlang-questions] default timeout values for a library (epgsql)
Mon Mar 10 20:37:40 CET 2014
I'd like to add couple of practical notes on top of essential statements made by Jesper and Fred.
The meaning of timeouts should differ depending on application use-cases and operation, e.g. reads are constrained by latency of data retrieval, writes by data consistency; OLTP queries should fail faster but OLAP can take longer time.
I am running a big MySQL data set with Erlang application and timeouts was major pain... The root cause of timeouts in 99.99% is not network partition or server crash. It is slow disk, large data set and un-optimal queries. I've made number of tweaks to the query interface to handle timeouts:
* both read/write methods of API provides timeout interface, any default or infinite timeouts would not work for API. Like it was stated in previous posts, write timeouts are most challenging one. Only application code can resolver them properly.
* API provides synchronous and asynchronous/non-blocking flavor to execute read/write requests. Sync calls are normal gen_server calls but async are traceable casts with mandatory feed-backs. Async calls allows to made client progress while waiting results of slow query.
These tweaks allows application to adapt to one of there desired use-cases...
> On 10 Mar 2014, at 12:30, David Welton <> wrote:
> We've been having something of a debate on the epgsql mailing list
> about timeouts for database queries:
> I thought that it'd be interesting to hear how other people handle
> things like this.
> One thing that looks like we need is the ability to specify a timeout,
> but, beyond that, I just thought I'd ask a wider group of people what
> their thoughts are on timeouts in library code like this.
> Thank you,
> David N. Welton
> erlang-questions mailing list
More information about the erlang-questions