[erlang-questions] Delegating supervision - was Re: [ANN]: New Erlvolt

Henning Diedrich <>
Sat Apr 13 01:15:40 CEST 2013


Hi Dmitry,

I think you have a good point. The more if you encountered the real world necessity to take control. And I wondered about this too at some point but found no good generic answer.

My first argument for why it is right as it is, would be that an application should have one top node. You probably don't want to have two to have a robust model.

List, how do other applications do it?

Henning

On Apr 12, 2013, at 10:32 AM, Dmitry Kolesnikov <> wrote:

> Hello,
> 
> Thanks for sharing it…
> 
> Just one issue pop-up in my mind, I was struggling with it in mysql drivers as well.
> The issue is here:
> erlvolt:add_pool(hello_pool, [{"localhost", 21212}]),
> From my perspective, the "connection" pool has to be supervised by the client application (not by the library). 
> The client application might have a different fault recovery principles while library makes it generic.
> I think that the supervisor tree is a good place for app to set-up/tear-down connection pools.
>   
> I would make it something like this:
> 
> %%
> -module(erlvolt).
> 
> -spec(start_link/2 :: (atom(), list()) -> {ok, pid} | {error, any()}).
> 
> then client application might implement what every fault management principles it like
>  * use it like in you example
>  * use it through supervisor
> 
> e.g.
> 
> %%
> %%
> -module(my_sup).
> -behaviour(supervisor).
> -export([start_link/0, init/1]).
> 
> start_link() ->
>    supervisor:start_link({local, ?MODULE}, ?MODULE, []).
> 
> %%
> %%
> init([]) -> 
>    {ok,
>       {
>          {one_for_one, 10, 900},  
>          [pool()]
>       }
>    }.
> 
> pool() ->
>    {
>       pool,
>       {erlvolt, start_link, [...]},
>       permanent, 1000, worker, dynamic
>    }.
> 
> 
> I'll appreciate if you share your thought on your design decision. 
> 
> - Dmitry
> 
> 
> 
> On Apr 12, 2013, at 7:53 AM, Henning Diedrich <> wrote:
> 
>> Hi list,
>> 
>> an all-new iteration of the VoltDB driver Erlvolt has been released.
>> 
>> It's easy to use, provides strong connection pooling, plus a broad array of options. It is optimized for a central node architecture, and maximal throughput.
>> 
>> VoltDB is a scalable, Open Source, high-performance data base for online transactions -- typically small data sets sent to a server at rapid pace and in high volume. Volt keeps SQL and ACID and scales pretty much linearly up to silly cluster sizes. I did a benchmark using AWS EC2 recently, where I got 877,000 transactions/second, equalling 3.5M operations/second (3 reads, 1 write + bonus: 2 materialized view updates). For details see: http://blog.voltdb.com/877000-tps-with-erlang-and-voltdb/
>> 
>> The Erlvolt driver is the result of the hunt for a better database for heavy duty online-game servers. I experienced first hand what a pain it could be to try to scale MySQL and found VoltDB better suited for the requirements of more complex game worlds. Better than any other database in fact for games with free player interaction. To be able to use it with Erlang, I started creating the Erlang driver for VoltDB.
>> 
>> Giving it a whirl takes seconds, plus a few short minutes build time. Simply execute these lines to clone, build, and run a simple benchmark:
>> 
>> 	git clone https://github.com/VoltDB/voltdb.git voltdb
>> 	git clone https://github.com/Eonblast/Erlvolt.git erlvolt
>> 	cd voltdb && ant && cd examples/voter && ./run.sh &
>> 	cd erlvolt && make profile bench
>> 
>> 
>> Hello World
>> ----------------
>> 
>> This is a hello world program. See the README.md for more. ( https://github.com/Eonblast/Erlvolt#Samples ) 
>> 
>> 	-module(hello).
>> 	-export([run/0]).
>> 	
>> 	-include("erlvolt.hrl").
>> 	
>> 	run() ->
>> 	
>> 	    crypto:start(),
>> 	    application:start(erlvolt),
>> 	
>> 	    erlvolt:add_pool(hello_pool, [{"localhost", 21212}]),
>> 	
>> 	    erlvolt:call_procedure(hello_pool, "Insert", ["Hej", "världen", "Swedish"]),
>> 	
>> 	    Result = erlvolt:call_procedure(hello_pool, "Select", ["Swedish"]),
>> 	
>> 	    Table = erlvolt:get_table(Result, 1),
>> 	    Row = erlvolt:get_row(Table, 1),
>> 	    Hello = erlvolt:get_string(Row, Table, "HELLO"), 
>> 	    World = erlvolt:get_string(Row, Table, "WORLD"),
>> 	
>> 	    io:format("~n~s ~s!~n~n", [Hello, World]),
>> 	
>> 	    erlvolt:close_pool(hello_pool).
>> 
>> 
>> Execution
>> -------------
>> 
>> The driver can serve multiple processes, using multiple connections and connection pools. Erlvolt can serve multiple pools in parallel.
>> 
>> Queries that are not implemented as stored procedures, so-called 'ad-hoc queries' are easily available with this driver, for tests and non-performance sensitive experimentation:
>> 
>> 	 R = erlvolt:call_procedure(mypool, "@AdHoc", ["SELECT COUNT(*) AS cnt FROM votes"]),
>> 
>> 
>> If you find time, please let me know your feedback!
>> 
>> Thanks,
>> 
>> Henning
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130413/44fa9fc8/attachment.html>


More information about the erlang-questions mailing list