The connection pooling algorithm does execute statements concurrently.
When an ErlyWeb process wants to execute a SQL statements, it sends it
to the MySQL dispatcher process (singleton per VM). This process
forwards the statement to a process holding a MySQL connection. The
connection process sends the statement to MySQL and then sends the
result back to the ErlyWeb process. You can start as many connection
processes as you want to add more concurrency -- the MySQL server
should be the bottleneck here.
This is how I start a connection pool with 21 connections for Vimagi:
erlydb:start(mysql, [{hostname, ?DB_HOSTNAME},
{username, ?DB_USERNAME}, {password, ?DB_PASSWORD},
{database, ?DB_DATABASE},
{logfun, fun log/4}]),
lists:foreach(
fun(_) ->
mysql:connect(erlydb_mysql, ?DB_HOSTNAME, undefined,
?DB_USERNAME, ?DB_PASSWORD, ?DB_DATABASE, true)
end, lists:seq(1, 20)),
On Fri, May 2, 2008 at 4:44 PM, db <[EMAIL PROTECTED]> wrote:
>
> Hi Yariv,
>
> I am looking at the mysql driver and it has connection pooling
> option. From what I understand, mysql statements are executed through
> gen_server callback functions. My understanding of gen_server is that
> it doesn't process request concurrently by default. That means you
> can only use one connection to execute sql at any point in time. To
> process request concurrently you have to spawn process within the
> callback functions.
>
>
> http://code.google.com/p/erlang-mysql-driver/source/browse/trunk/src/mysql.erl
>
> I do not know the internals of erlang mysql driver, can you shed some
> light on this?
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---