Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  multiple connection pools support

Guest
Posted: Wed Aug 29, 2007 5:59 am Reply with quote
Guest
Hi,

In trunk, I added initial support for multiple connection pools in
ErlyWeb. NOTE: this only works for MySQL. In fact the other drivers
are probably broken now in trunk until they are updated to match the
changes to erlydb_mysql. Don't SVN upgrade from trunk right now unless
you're using the MySQL driver.

To use it, pass any extra connection pool names to erlyweb_compile()
in the options, e.g.

erlyweb:compile("/apps/foo", [{erlydb_driver, mysql}, {auto_compile,
true}, debug_info, {pool_id, pool1}, {pool_id, pool2]).

This tells ErlyDB to use those extra connection pools (pool1 and
pool2) when generating code for available models.

If you have a model that maps to a non-default pool, e.g, pool1, put
the following in the top of its file:

-erlydb_options([{pool_id, pool1}]).

This would tell ErlyWeb to use pool1 when issuing database queries for
the model.

Currently, there's not support for using different drivers for
different models, but it's planned.

Please test it and let me know if you find problems.

Thanks,
Yariv

P.S Roberto, can I get svn access to erland-postgres-driver?

--~--~---------~--~----~------------~-------~--~----~
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 recived from mailinglist
Guest
Posted: Thu Aug 30, 2007 6:03 am Reply with quote
Guest
Hi

What would it take to have dynamic pool_ids?

The reason I ask, is that I have two identical instruments, one
flying, one acting as ground reference. Now the cleanest way to handle
the data would be to have two identically structured databases,
accessed with identical routines. Differentiation would happen by
selecting, which database to use. Of course I could close down the sql-
connection and restart it with the other database. In principle, when
and if the databases are identical, it should work. But when there are
multiple accesses from the web, asking data from both databases, it
gets hmmm complicated.

Now thinking about it, it would mean having extra pool_id parameter to
ALL the access functions. Or a session process global. A process
private ets-table for pool_id lookup?

Any ideas?

Jouni.


On Aug 29, 8:52 am, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> Hi,
>
> In trunk, I added initial support for multiple connection pools inErlyWeb.
>
> Currently, there's not support for using different drivers for
> different models, but it's planned.
>


--~--~---------~--~----~------------~-------~--~----~
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 recived from mailinglist
Guest
Posted: Thu Aug 30, 2007 8:06 am Reply with quote
Guest
If I understand the problem correctly, you want to switch the database
that your application uses on the fly, i.e. redirect all queries from
database A to database B while the app is running. This is a pretty
uncommon scenario... I think your best bet is to hack the mysql driver
(assuming you're using mysql) so that it can drop all connections from
a given connection pool and reconnect to a different database using
the same pool id.

I hope I got the problem right.

Yariv

On 8/29/07, Joneksi <Jouni.Ryno@gmail.com> wrote:
>
> Hi
>
> What would it take to have dynamic pool_ids?
>
> The reason I ask, is that I have two identical instruments, one
> flying, one acting as ground reference. Now the cleanest way to handle
> the data would be to have two identically structured databases,
> accessed with identical routines. Differentiation would happen by
> selecting, which database to use. Of course I could close down the sql-
> connection and restart it with the other database. In principle, when
> and if the databases are identical, it should work. But when there are
> multiple accesses from the web, asking data from both databases, it
> gets hmmm complicated.
>
> Now thinking about it, it would mean having extra pool_id parameter to
> ALL the access functions. Or a session process global. A process
> private ets-table for pool_id lookup?
>
> Any ideas?
>
> Jouni.
>
>
> On Aug 29, 8:52 am, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> > Hi,
> >
> > In trunk, I added initial support for multiple connection pools inErlyWeb.
> >
> > Currently, there's not support for using different drivers for
> > different models, but it's planned.
> >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 recived from mailinglist
Guest
Posted: Thu Aug 30, 2007 12:19 pm Reply with quote
Guest
You understood it correctly. Now I have to write double code to for
exactly the same functionality, IF I use the same server for both.

What I could easily do instead, now that I thought about it, is to
have separate logical servers, i.e. model1.domain and model2.domain.
They can then reuse the exactly same code inside the same yaws server.
Cross-referencing links can then use the full url-specifications with
host name. Witch is good enough. Except for one of the server
instances I will have problems getting the nameserver domain ...fixed
IP, but external to the institute.

Thanks, have to think a little more, what to do.
Jouni


On Aug 30, 9:48 am, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> If I understand the problem correctly, you want to switch the database
> that your application uses on the fly, i.e. redirect all queries from
> database A to database B while the app is running. This is a pretty
> uncommon scenario... I think your best bet is to hack the mysql driver
> (assuming you're using mysql) so that it can drop all connections from
> a given connection pool and reconnect to a different database using
> the same pool id.
>
> I hope I got the problem right.
>
> Yariv
>
> On 8/29/07, Joneksi <Jouni.R...@gmail.com> wrote:
>
>
>
> > Hi
>
> > What would it take to have dynamic pool_ids?
>
> > The reason I ask, is that I have two identical instruments, one
> > flying, one acting as ground reference. Now the cleanest way to handle
> > the data would be to have two identically structured databases,
> > accessed with identical routines. Differentiation would happen by
> > selecting, which database to use. Of course I could close down the sql-
> > connection and restart it with the other database. In principle, when
> > and if the databases are identical, it should work. But when there are
> > multiple accesses from the web, asking data from both databases, it
> > gets hmmm complicated.
>
> > Now thinking about it, it would mean having extra pool_id parameter to
> > ALL the access functions. Or a session process global. A process
> > private ets-table for pool_id lookup?
>
> > Any ideas?
>
> > Jouni.
>
> > On Aug 29, 8:52 am, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> > > Hi,
>
> > > In trunk, I added initial support for multiple connection pools inErlyWeb.
>
> > > Currently, there's not support for using different drivers for
> > > different models, but it's planned.


--~--~---------~--~----~------------~-------~--~----~
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 recived from mailinglist

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