Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  connection pooling question

Guest
Posted: Fri May 02, 2008 11:45 pm Reply with quote
Guest
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 erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post received from mailinglist
Guest
Posted: Mon May 05, 2008 3:23 am Reply with quote
Guest
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 <masterofquestions@gmail.com> 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 erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post received from mailinglist
wailian
Posted: Tue Mar 20, 2012 2:14 am Reply with quote
Guest
i/p transducer requires a standard input and is for use with linear pneumatic actuators and has high air capacity. It can be easy change of the output signal from. electro pneumatic transducer is used, for example, in the biomedical field for the pneumatic control of a cardiac module, or artificial heart.

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum