On 2012-03-23, at 8:58 AM, Ramsey Gurley wrote:

> My main goal is to better understand EOF conceptually :-) I was playing with 
> the ERXOSCPool just for kicks and found a leak. I wondered why an entirely 
> new OSC was even needed to make a second connection to the db.  Seems like 
> overkill. So I fugetuboutit.

It is the only way to get parallel database operations in a single instance.


> Later, I'm rereading through the old docs and find that little gem about 
> opening new database channels.  It seems that at least conceptually, creating 
> new channels would be the proper way to handle multiple connections to the 
> database.
> 
> But it doesn't work. After finding the object store lock… I wonder if it ever 
> worked?  The fact that it was documented makes me think that maybe once upon 
> a time, it worked.  However, this wouldn't be the first time the docs were 
> totally wrong.  The fact that it suggests making every session in the app a 
> listener for that notification only reinforces my suspicions that the docs 
> were just wrong.

I'd go with wrong.  It may have had an application back when EOF was for 
desktop applications running on a single user's machine.  Web apps are a quite 
different environment.  I know that at least as far back at WO 4.01 this did 
not work.


> Because of the lock, that notification is only ever fired once.

It will get fired again if you do something like trip a fetch (say from 
awakeFromFetch) while a fetch is in progress.  But, really, why would you want 
to do that?  I only know about that as long, long ago FrontBase's plugin 
started running validateForSave (I think) as part of the fetch.  Or something.  
But that was a short lived bug.


> So it's possible to create multiple connections, but only one of them will 
> ever be used. The docs also suggest that an EODatabase may have multiple 
> EODatabaseContexts.  But then this will have the same problem with the object 
> store lock and may even exhibit the same problem that results in leaks in the 
> OSCPool.

From the docs, it sure looks like someone has a different idea/plan at some 
point in the past.  I have no idea what happened.


> I'm coming to the conclusion that the best way to distribute load across 
> multiple channels would be to simply have multiple instances of an app. 
> Knowing that would definitely have an influence on any sort of bulk 
> processing operations I might design in the future.

Having multiple OSCs (EOF stacks) can be of some use.  You have the memory 
needed to load all of the classes, the JVM etc, so it can be more memory 
effective for some applications.


> I also wonder if this information can be used to implement more effective 
> load balancing.  No reason to direct users to an instance if one user on that 
> instance has EOF tied up fetching a large blob out of the database for 
> instance. I'll have to look for the location of the load balancer in WO 
> sometime.  I'd like to see how it works.

It is in mod_webObjects.


> Anyway, thanks for all the input everyone :-) I think I understand the point 
> of the object store lock now.

:-)


Chuck


> On Mar 22, 2012, at 7:53 PM, Chuck Hill wrote:
> 
>> OK, so... my first question has to be "what is your goal?  What are you 
>> trying to accomplish?"  This is NOT going to make EOF multi-threaded.
>> 
>> 
>> Chuck
>> 
>> 
>> On 2012-03-22, at 7:34 PM, Ramsey Gurley wrote:
>> 
>>> Hi all,
>>> 
>>> I'm looking at trying to open multiple database channels in a single 
>>> instance of a WO app. No reason, just wondering if it can be done.  I know 
>>> there's ERXObjectStoreCoordinator pool, but this conceptually seems like 
>>> the wrong way to do it.  Maybe I want 4 open connections for one database, 
>>> but only one on another… whatever.  So I have a look at
>>> 
>>> https://developer.apple.com/legacy/mac/library/documentation/WebObjects/Enterprise_Objects/Connecting/Connecting.html#//apple_ref/doc/uid/TP30001011-CH210-TPXREF145
>>> 
>>> and this seems to be the answer to my question.  Well, until I try it. It 
>>> turns out that inside of objectsWithFetchSpec on EOEditingContext, the 
>>> objectstore is locked before a fetch takes place. As a result, no other 
>>> fetch can proceed until the object store is unlocked.  The answer seemed 
>>> suspicious in the fact that it's being done on the Session anyway...
>>> 
>>> So, I guess my question boils down to… is it even possible? Is this the 
>>> 'single EOF lock' that Chuck Hill and Ravi Mendis were referring to in a 
>>> previous list message?
>>> 
>>> Thanks,
>>> 
>>> Ramsey
>>> 
>>> 
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>>> 
>>> This email sent to [email protected]
>> 
>> -- 
>> Chuck Hill             Senior Consultant / VP Development
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.    
>> http://www.global-village.net/gvc/practical_webobjects
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 

-- 
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/gvc/practical_webobjects








Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to