model connections to multiple DBs
Hi all, Is there a way to have a model connect to different databases simultaneously? So, I have a schema that is rev. eng'ed but that same schema is on 10 different databases, I want to fetch data from different DB's for different users of the system simultaneously. Is this possible? omg please say YES. :) Thanks. -Mike ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: model connections to multiple DBs
i think it's a big no :-( but you can definitely have multiple models - one for each db - and relationships between the models. simon On 4 April 2011 16:00, Michael Gargano mgarg...@escholar.com wrote: Hi all, Is there a way to have a model connect to different databases simultaneously? So, I have a schema that is rev. eng'ed but that same schema is on 10 different databases, I want to fetch data from different DB's for different users of the system simultaneously. Is this possible? omg please say YES. :) Thanks. -Mike ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk This email sent to si...@potwells.co.uk ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: model connections to multiple DBs
Yeah, that's the way to go. Reverse engineer each database into it's own EOModel, then build the relationships between the models. Be mindful that EO's can NOT have the same names across your models. So you may have to put prefixes on the EO's after you reverse engineer the DB tables. Paul On Apr 4, 2011, at 11:04 AM, Simon wrote: i think it's a big no :-( but you can definitely have multiple models - one for each db - and relationships between the models. simon On 4 April 2011 16:00, Michael Gargano mgarg...@escholar.com wrote: Hi all, Is there a way to have a model connect to different databases simultaneously? So, I have a schema that is rev. eng'ed but that same schema is on 10 different databases, I want to fetch data from different DB's for different users of the system simultaneously. Is this possible? omg please say YES. :) Thanks. -Mike ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk This email sent to si...@potwells.co.uk ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/pyu%40mac.com This email sent to p...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: model connections to multiple DBs
Le 2011-04-04 à 11:04, Simon a écrit : i think it's a big no :-( but you can definitely have multiple models - one for each db - and relationships between the models. +1. And it should make using migrations (especially Migration0) more easier to deal with. simon On 4 April 2011 16:00, Michael Gargano mgarg...@escholar.com wrote: Hi all, Is there a way to have a model connect to different databases simultaneously? So, I have a schema that is rev. eng'ed but that same schema is on 10 different databases, I want to fetch data from different DB's for different users of the system simultaneously. Is this possible? omg please say YES. :) Thanks. -Mike ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk This email sent to si...@potwells.co.uk ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca This email sent to prob...@macti.ca ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: model connections to multiple DBs
Actually, it's a yes. You can create one EOF stack per user and clone the model group so it's used in that stack. Then adjust the model dict for the connection and you're good to go. You need to take really good care you never use EOModelGroup.defaultGroup() anywhere, though. Cheers, Anjo Am 04.04.2011 um 17:04 schrieb Simon: i think it's a big no :-( but you can definitely have multiple models - one for each db - and relationships between the models. simon On 4 April 2011 16:00, Michael Gargano mgarg...@escholar.com wrote: Hi all, Is there a way to have a model connect to different databases simultaneously? So, I have a schema that is rev. eng'ed but that same schema is on 10 different databases, I want to fetch data from different DB's for different users of the system simultaneously. Is this possible? omg please say YES. :) Thanks. -Mike ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk This email sent to si...@potwells.co.uk ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/anjo%40krank.net This email sent to a...@krank.net ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: model connections to multiple DBs
That's bad for me, I need to be able to bring new DB's on dynamically. It wouldn't be possible to rev. eng. each one as needed. This is quite a road block for me. *sigh* -Mike On Apr 4, 2011, at 11:04 AM, Simon wrote: i think it's a big no :-( but you can definitely have multiple models - one for each db - and relationships between the models. simon On 4 April 2011 16:00, Michael Gargano mgarg...@escholar.com wrote: Hi all, Is there a way to have a model connect to different databases simultaneously? So, I have a schema that is rev. eng'ed but that same schema is on 10 different databases, I want to fetch data from different DB's for different users of the system simultaneously. Is this possible? omg please say YES. :) Thanks. -Mike ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk This email sent to si...@potwells.co.uk ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: model connections to multiple DBs
Please keep this on-list. I haven't actually tried it and don't know what you mean by overhead, but the core idea would be sth like: public Session() { EOModelGroup modelGroup = new EOModelGroup(); EOModel model = modelGroup.addModelWithPath(/some/where); // model should be in a subfolder of Resources so it won't get loaded adjustConnectionDict(model); EOAdaptor adaptor = EOAdaptor.adaptorWithModel(model); EODatabaseContext dbc = new EODatabaseContext(adaptor); EOObjectStoreCoordinator osc = new EOObjectStoreCoordinator(); osc.addCooperatingObjectStore(dbc); EOEditingContext ec = new EOEditingContext(osc); setDefaultEditingContext(ec); } This probably won't even compile, but should get you started. All other ECs must be created as new EOEditingContext(session().defaultEditingContext().parentObjectStore()) or from a thread-local. Cheers, Anjo Am 04.04.2011 um 17:17 schrieb Michael Gargano: This sounds good to me. :-D Two questions... how much overhead is this? (as i'm sure this is not a light weight process) where do i find out how to dynamically create new eof stacks? Thanks. -Mike On Apr 4, 2011, at 11:11 AM, Anjo Krank wrote: Actually, it's a yes. You can create one EOF stack per user and clone the model group so it's used in that stack. Then adjust the model dict for the connection and you're good to go. You need to take really good care you never use EOModelGroup.defaultGroup() anywhere, though. Cheers, Anjo Am 04.04.2011 um 17:04 schrieb Simon: i think it's a big no :-( but you can definitely have multiple models - one for each db - and relationships between the models. simon On 4 April 2011 16:00, Michael Gargano mgarg...@escholar.com wrote: Hi all, Is there a way to have a model connect to different databases simultaneously? So, I have a schema that is rev. eng'ed but that same schema is on 10 different databases, I want to fetch data from different DB's for different users of the system simultaneously. Is this possible? omg please say YES. :) Thanks. -Mike ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk This email sent to si...@potwells.co.uk ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/anjo%40krank.net This email sent to a...@krank.net ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mgargano%40escholar.com This email sent to mgarg...@escholar.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: model connections to multiple DBs
Sorry, I thought I replied all. Thanks. I'll start here. With overhead I just mean that the setup for a new EOF stack must not be very fast and my guess is that it's going to use a fairly large amount of memory. -Mike On Apr 4, 2011, at 11:30 AM, Anjo Krank wrote: Please keep this on-list. I haven't actually tried it and don't know what you mean by overhead, but the core idea would be sth like: public Session() { EOModelGroup modelGroup = new EOModelGroup(); EOModel model = modelGroup.addModelWithPath(/some/where); // model should be in a subfolder of Resources so it won't get loaded adjustConnectionDict(model); EOAdaptor adaptor = EOAdaptor.adaptorWithModel(model); EODatabaseContext dbc = new EODatabaseContext(adaptor); EOObjectStoreCoordinator osc = new EOObjectStoreCoordinator(); osc.addCooperatingObjectStore(dbc); EOEditingContext ec = new EOEditingContext(osc); setDefaultEditingContext(ec); } This probably won't even compile, but should get you started. All other ECs must be created as new EOEditingContext(session().defaultEditingContext().parentObjectStore()) or from a thread-local. Cheers, Anjo Am 04.04.2011 um 17:17 schrieb Michael Gargano: This sounds good to me. :-D Two questions... how much overhead is this? (as i'm sure this is not a light weight process) where do i find out how to dynamically create new eof stacks? Thanks. -Mike On Apr 4, 2011, at 11:11 AM, Anjo Krank wrote: Actually, it's a yes. You can create one EOF stack per user and clone the model group so it's used in that stack. Then adjust the model dict for the connection and you're good to go. You need to take really good care you never use EOModelGroup.defaultGroup() anywhere, though. Cheers, Anjo Am 04.04.2011 um 17:04 schrieb Simon: i think it's a big no :-( but you can definitely have multiple models - one for each db - and relationships between the models. simon On 4 April 2011 16:00, Michael Gargano mgarg...@escholar.com wrote: Hi all, Is there a way to have a model connect to different databases simultaneously? So, I have a schema that is rev. eng'ed but that same schema is on 10 different databases, I want to fetch data from different DB's for different users of the system simultaneously. Is this possible? omg please say YES. :) Thanks. -Mike ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk This email sent to si...@potwells.co.uk ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/anjo%40krank.net This email sent to a...@krank.net ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mgargano%40escholar.com This email sent to mgarg...@escholar.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mgargano%40escholar.com This email sent to mgarg...@escholar.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: model connections to multiple DBs
Hi Michael, I have created a prototype with the intent to evaluate this kind of solution. You can download the source code from GitHub [1]. It uses a very simple model and it is not feature complete, but you can easily verify the memory consumption problem. You can create tenants after running the application. You can also fetch, create and edit data for each tenant. You can define the initial number of tenants changing the value of Application.MAX_ENTRIES property. It is a good idea to run the application with a profiler attached. [1]https://github.com/hprange/multi-tenant-prototype Cheers, Henrique On 04/04/2011, at 12:49, Michael Gargano wrote: Sorry, I thought I replied all. Thanks. I'll start here. With overhead I just mean that the setup for a new EOF stack must not be very fast and my guess is that it's going to use a fairly large amount of memory. -Mike On Apr 4, 2011, at 11:30 AM, Anjo Krank wrote: Please keep this on-list. I haven't actually tried it and don't know what you mean by overhead, but the core idea would be sth like: public Session() { EOModelGroup modelGroup = new EOModelGroup(); EOModel model = modelGroup.addModelWithPath(/some/where); // model should be in a subfolder of Resources so it won't get loaded adjustConnectionDict(model); EOAdaptor adaptor = EOAdaptor.adaptorWithModel(model); EODatabaseContext dbc = new EODatabaseContext(adaptor); EOObjectStoreCoordinator osc = new EOObjectStoreCoordinator(); osc.addCooperatingObjectStore(dbc); EOEditingContext ec = new EOEditingContext(osc); setDefaultEditingContext(ec); } This probably won't even compile, but should get you started. All other ECs must be created as new EOEditingContext(session().defaultEditingContext().parentObjectStore()) or from a thread-local. Cheers, Anjo Am 04.04.2011 um 17:17 schrieb Michael Gargano: This sounds good to me. :-D Two questions... how much overhead is this? (as i'm sure this is not a light weight process) where do i find out how to dynamically create new eof stacks? Thanks. -Mike On Apr 4, 2011, at 11:11 AM, Anjo Krank wrote: Actually, it's a yes. You can create one EOF stack per user and clone the model group so it's used in that stack. Then adjust the model dict for the connection and you're good to go. You need to take really good care you never use EOModelGroup.defaultGroup() anywhere, though. Cheers, Anjo Am 04.04.2011 um 17:04 schrieb Simon: i think it's a big no :-( but you can definitely have multiple models - one for each db - and relationships between the models. simon On 4 April 2011 16:00, Michael Gargano mgarg...@escholar.com wrote: Hi all, Is there a way to have a model connect to different databases simultaneously? So, I have a schema that is rev. eng'ed but that same schema is on 10 different databases, I want to fetch data from different DB's for different users of the system simultaneously. Is this possible? omg please say YES. :) Thanks. -Mike ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk This email sent to si...@potwells.co.uk ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/anjo%40krank.net This email sent to a...@krank.net ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mgargano%40escholar.com This email sent to mgarg...@escholar.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mgargano%40escholar.com This email sent to mgarg...@escholar.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com This email sent to hpra...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Re: model connections to multiple DBs
Depending on the actual data, the memory consumption won't be any different in comparison to a solution based on a shared DB. Only the reference tables could be re-used, all the other data belongs to the tenant anyway. Add to that the larger size of the individual records (you'd need the tenant references in most items) I'd be surprised if it actually amounted to a large difference. Cheers, Anjo Am 04.04.2011 um 18:13 schrieb Henrique Prange: I have created a prototype with the intent to evaluate this kind of solution. You can download the source code from GitHub [1]. It uses a very simple model and it is not feature complete, but you can easily verify the memory consumption problem. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: model connections to multiple DBs
Hi Anjo, On 04/04/2011, at 14:25, Anjo Krank wrote: Depending on the actual data, the memory consumption won't be any different in comparison to a solution based on a shared DB. I haven't explored beyond that simple experiment. So, I can't confirm. What I have learned with this experiment is: 1) Yes, EOF can handle a multi tenant architecture with a single model and multiple databases/stacks. I haven't faced any technical problems fetching, creating and editing data using this architecture. 2) Yes, memory consumption is higher if compared to a multi tenant architecture with single model and single database. But it is much better than the sum of the memory consumed by each application in a single application per tenant approach. 3) No, EOF is not optimized for this architecture. A superficial analysis of memory consumption even in that simple example reveals some points for optimization in the EOF code. Certainly, EOF could handle this architecture in an improved way after a few hacks. :) In conclusion, if the number of expected tenants per application is relative low (let's say up to 50 tenants) this approach is reasonable. If the number of tenants is expected to be much higher then it is impracticable without optimizations. Cheers, Henrique Only the reference tables could be re-used, all the other data belongs to the tenant anyway. Add to that the larger size of the individual records (you'd need the tenant references in most items) I'd be surprised if it actually amounted to a large difference. Cheers, Anjo Am 04.04.2011 um 18:13 schrieb Henrique Prange: I have created a prototype with the intent to evaluate this kind of solution. You can download the source code from GitHub [1]. It uses a very simple model and it is not feature complete, but you can easily verify the memory consumption problem. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com This email sent to hpra...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com