You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adam Heath <do...@brainfood.com> on 2010/06/25 20:20:18 UTC

concurrent, parallel loading stuff

I've got a change to ofbiz startup to make loading of the webapps run
in parallel.  Unfortunately, it's been taking me longer than I'd like
to get working completely.

Catalina itself is single-threaded when loading the webapps attached
to a particular host.  That fix required me initializing the Context
classes myself before adding to the host.  Unfortunately, that had 2
concurrency bugs in catalina, that I had to hack around.  One was yet
another synchronization.  The other was corruption when catalina tried
to use a global static map to old intermediate data while parsing the
web.xml files.

However, once I got all those fixed, ofbiz itself stopped the
parallelization.  The startup code called by ControlServlet and
ContextFilter end up calling into synchronized ofbiz blocks, which
effectively stops things from running in parallel.  My fix there is to
remove the synchronized blocks, and switch to more concurrent type algos.

The latest problem with that, is that FastMap was used to hold the
list of components found.  When things are inserted into a FastMap,
iteration over the values maintains the order that they were added in.
 Switching to ConcurrentHashMap, or ConcurrentLinkedHashMap, gives
things back in an effectively random order.  My plan here is to add
'dependencies' to the component definitions.  Then, if no dependencies
are specified for a particular ofbiz-component.xml, it'll default to
depending on all currently loaded components.  I already have a
dependency resolver written, to put the components in the proper
order.  This will also allow us to start encoding real dependency
settings into ofbiz.

I should have this all ready to go by sunday evening.

Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by BJ Freeman <bj...@free-man.net>.
http://demo-trunk.ofbiz.apache.org/ecommerce/
       :ERROR MESSAGE:
       org.ofbiz.widget.screen.ScreenRenderException: Error rendering 
screen [component://ecommerce/widget/ContentScreens.xml#factoids]: 
java.lang.UnsupportedOperationException (null)

as reported on the user ML

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Adam Heath sent the following on 6/25/2010 1:20 PM:
> BJ Freeman wrote:
>> as i said don't believe it is you.
>> however from my email on the user ML
>> LimitedSubContentCacheTransform.java has not been touched since the 4th.
>> here is the log from the site
>> --------------------------------------------------------------
>> java.lang.UnsupportedOperationException
>> javolution.util.FastCollection.add(FastCollection.java:169)
>> org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.prepCtx(LimitedSubContentCacheTransform.java:264)
>> org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.getNextMatchingEntity(LimitedSubContentCacheTransform.java:319)
>> org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.afterBody(LimitedSubContentCacheTransform.java:203)
>
> As always, report the full exception, and steps to reproduce.
>
> At a guess, this is due to a FastMap having keySet() or values() be
> called, and upper-level code then trying to do an add() on the
> resulting collection.
>
> This is not a bug in javolution, or in the internal code in ofbiz that
> returns a keySet() or values() directly.  The bug is that the
> low-level code is attempting to modify the collection; it shouldn't be
> doing that.
>


Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
Adam Heath wrote:
> Adam Heath wrote:
>> Adam Heath wrote:
>>> BJ Freeman wrote:
>>>> I check the ofbiz code files for any changes since last week and now. I
>>>> did not see any.
>>>> I have a trunk version that does not have this error from last week.
>>> I've got it isolated, but not fixed.  FastList is not functioning the
>>> same as ArrayList, and it's got me purplexed.  Still investigating.
>> Wow, what a bug.
>>
>> ArrayList.subList().add(Object) works.
>>
>> FastList.subList().add(Object) throws UnsupportedOperationException.
> 
> I'll file a javolution bug about this.

https://javolution.dev.java.net/issues/show_bug.cgi?id=72


Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by BJ Freeman <bj...@free-man.net>.
highest priority is ofbiz is stable.
second priority is consistency in code.

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Adam Heath sent the following on 6/25/2010 4:27 PM:
> BJ Freeman wrote:
>> thanks have updated the thread on user ML
>
> I'm debating whether to roll back my change; granted, that is what
> caused this ofbiz bug.  However, there's nothing that says we couldn't
> have the same problem occur with other uses of FastList.subList.add().
>
>


Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
BJ Freeman wrote:
> thanks have updated the thread on user ML

I'm debating whether to roll back my change; granted, that is what
caused this ofbiz bug.  However, there's nothing that says we couldn't
have the same problem occur with other uses of FastList.subList.add().


Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by BJ Freeman <bj...@free-man.net>.
thanks have updated the thread on user ML

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Adam Heath sent the following on 6/25/2010 4:18 PM:
> I'll file a javolution bug about this.


Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
Adam Heath wrote:
> Adam Heath wrote:
>> BJ Freeman wrote:
>>> I check the ofbiz code files for any changes since last week and now. I
>>> did not see any.
>>> I have a trunk version that does not have this error from last week.
>> I've got it isolated, but not fixed.  FastList is not functioning the
>> same as ArrayList, and it's got me purplexed.  Still investigating.
> 
> Wow, what a bug.
> 
> ArrayList.subList().add(Object) works.
> 
> FastList.subList().add(Object) throws UnsupportedOperationException.

I'll file a javolution bug about this.

Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
BJ Freeman wrote:
> that is about what I expected
> thanks for finding it.
> what caused it though.

956470, which is something I did.  But I wouldn't expect that FastList
would not obey the List.subList contract, specifically that the
returned list supports the same set of optional methods as the original.

Since the original supports add(Object), the subList should as well.

Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by BJ Freeman <bj...@free-man.net>.
that is about what I expected
thanks for finding it.
what caused it though.

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Adam Heath sent the following on 6/25/2010 4:11 PM:
> Adam Heath wrote:
>> BJ Freeman wrote:
>>> I check the ofbiz code files for any changes since last week and now. I
>>> did not see any.
>>> I have a trunk version that does not have this error from last week.
>>
>> I've got it isolated, but not fixed.  FastList is not functioning the
>> same as ArrayList, and it's got me purplexed.  Still investigating.
>
> Wow, what a bug.
>
> ArrayList.subList().add(Object) works.
>
> FastList.subList().add(Object) throws UnsupportedOperationException.
>


Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
Adam Heath wrote:
> BJ Freeman wrote:
>> I check the ofbiz code files for any changes since last week and now. I
>> did not see any.
>> I have a trunk version that does not have this error from last week.
> 
> I've got it isolated, but not fixed.  FastList is not functioning the
> same as ArrayList, and it's got me purplexed.  Still investigating.

Wow, what a bug.

ArrayList.subList().add(Object) works.

FastList.subList().add(Object) throws UnsupportedOperationException.

Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
BJ Freeman wrote:
> I check the ofbiz code files for any changes since last week and now. I
> did not see any.
> I have a trunk version that does not have this error from last week.

I've got it isolated, but not fixed.  FastList is not functioning the
same as ArrayList, and it's got me purplexed.  Still investigating.

Re: FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by BJ Freeman <bj...@free-man.net>.
I check the ofbiz code files for any changes since last week and now. I 
did not see any.
I have a trunk version that does not have this error from last week.


=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Adam Heath sent the following on 6/25/2010 1:20 PM:
> BJ Freeman wrote:
>> as i said don't believe it is you.
>> however from my email on the user ML
>> LimitedSubContentCacheTransform.java has not been touched since the 4th.
>> here is the log from the site
>> --------------------------------------------------------------
>> java.lang.UnsupportedOperationException
>> javolution.util.FastCollection.add(FastCollection.java:169)
>> org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.prepCtx(LimitedSubContentCacheTransform.java:264)
>> org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.getNextMatchingEntity(LimitedSubContentCacheTransform.java:319)
>> org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.afterBody(LimitedSubContentCacheTransform.java:203)
>
> As always, report the full exception, and steps to reproduce.
>
> At a guess, this is due to a FastMap having keySet() or values() be
> called, and upper-level code then trying to do an add() on the
> resulting collection.
>
> This is not a bug in javolution, or in the internal code in ofbiz that
> returns a keySet() or values() directly.  The bug is that the
> low-level code is attempting to modify the collection; it shouldn't be
> doing that.
>


FastCollection.add -> UnsupportedOperationException Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
BJ Freeman wrote:
> as i said don't believe it is you.
> however from my email on the user ML
> LimitedSubContentCacheTransform.java has not been touched since the 4th.
> here is the log from the site
> --------------------------------------------------------------
> java.lang.UnsupportedOperationException
> javolution.util.FastCollection.add(FastCollection.java:169)
> org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.prepCtx(LimitedSubContentCacheTransform.java:264)
> org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.getNextMatchingEntity(LimitedSubContentCacheTransform.java:319)
> org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.afterBody(LimitedSubContentCacheTransform.java:203)

As always, report the full exception, and steps to reproduce.

At a guess, this is due to a FastMap having keySet() or values() be
called, and upper-level code then trying to do an add() on the
resulting collection.

This is not a bug in javolution, or in the internal code in ofbiz that
returns a keySet() or values() directly.  The bug is that the
low-level code is attempting to modify the collection; it shouldn't be
doing that.

Re: concurrent, parallel loading stuff

Posted by BJ Freeman <bj...@free-man.net>.
as i said don't believe it is you.
however from my email on the user ML
LimitedSubContentCacheTransform.java has not been touched since the 4th.
here is the log from the site
-------------------------------------------------------------- 
java.lang.UnsupportedOperationException 
javolution.util.FastCollection.add(FastCollection.java:169) 
org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.prepCtx(LimitedSubContentCacheTransform.java:264) 
org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.getNextMatchingEntity(LimitedSubContentCacheTransform.java:319) 
org.ofbiz.content.webapp.ftl.LimitedSubContentCacheTransform$1.afterBody(LimitedSubContentCacheTransform.java:203) 


=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Adam Heath sent the following on 6/25/2010 1:06 PM:
> BJ Freeman wrote:
>> not saying it is you but currently the svn is broken.
>> it looks like library
>> how did this get through the testing that buildbot does.
>> if your code does not break the ability to use external tomcat. then I
>> agree no documentation.
>> how ever if your testing shows it does then the documentation that talks
>> about using ofbiz with external servers like weblogic has to be modified.
>> To the credit of everyone, I think under a minute for a application the
>> size of ofbiz, in java, is history making.
>
> Broken, how?  I haven't committed anything I've talked about in this
> thread yet.
>
> The synchronization stuff affects everything, so will improve it no
> matter how ofbiz is being used.
>
> The catalina bugs I've had to work around are only in the catalina
> container.
>


Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
BJ Freeman wrote:
> not saying it is you but currently the svn is broken.
> it looks like library
> how did this get through the testing that buildbot does.
> if your code does not break the ability to use external tomcat. then I
> agree no documentation.
> how ever if your testing shows it does then the documentation that talks
> about using ofbiz with external servers like weblogic has to be modified.
> To the credit of everyone, I think under a minute for a application the
> size of ofbiz, in java, is history making.

Broken, how?  I haven't committed anything I've talked about in this
thread yet.

The synchronization stuff affects everything, so will improve it no
matter how ofbiz is being used.

The catalina bugs I've had to work around are only in the catalina
container.

Re: concurrent, parallel loading stuff

Posted by BJ Freeman <bj...@free-man.net>.
not saying it is you but currently the svn is broken.
it looks like library
how did this get through the testing that buildbot does.
if your code does not break the ability to use external tomcat. then I 
agree no documentation.
how ever if your testing shows it does then the documentation that talks 
about using ofbiz with external servers like weblogic has to be modified.
To the credit of everyone, I think under a minute for a application the 
size of ofbiz, in java, is history making.


=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Adam Heath sent the following on 6/25/2010 12:44 PM:
> BJ Freeman wrote:
>> what is your target for start up.
>> I am less than one minute on mine.
>> Not sure breaking an established convention without discussion is a good
>> idea.
>> are you willing to go through all the test and change documentation?
>
> documentation change ->  none.  It just works automatically.
>
> The synchronization changes are needed anyways to speed up normal
> operations.  servlet containers are already thread pool based, and
> these synchronization issues are a point of contention.
>
> I already do lots of testing before committing stuff.  I can't tell
> you how many times I've gone and hung out with friends, while I have a
> series of 10 or 30 commits being automatically tested, before ever
> committing them.
>
> I currently have over 100 commits in my queue, due to various
> different features I'm working on.
>
> * removal of synchronization in ton of places(still under
>    development/testing)
> * cleanup of stale threads in helper classes at shutdown(reported
>    by adrian, altho something I really don't consider a bug, will
>    send a separate email soon to discuss)
> * cobertura instrumentation in parallel(tested, reading to go)
> * major sql parser updates
>    * it's more generic.  eventually will be useful for implementing
>      a native jdbc driver that is backed by the ofbiz entity engine
>    * union support
>    * order by function support
> * multi-threaded creation of database items(table, fk index,
>    declared index)
> * multi-threaded data loading
> * unix crypt-compatible password hashing
> * improve filterProductsInCategory to handle categories with
>    thousands(like 40,000) products in them.
> * webslinger's commons-vfs implementation
>    * non-blocking in all cases
>    * only uses the interfaces from commons-vfs, none of the
>      implementations
>    * COW(actually, overlay with whiteout support)
>
> Some of these changes I started back in February.
>
>


Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
BJ Freeman wrote:
> what is your target for start up.
> I am less than one minute on mine.
> Not sure breaking an established convention without discussion is a good
> idea.
> are you willing to go through all the test and change documentation?

documentation change -> none.  It just works automatically.

The synchronization changes are needed anyways to speed up normal
operations.  servlet containers are already thread pool based, and
these synchronization issues are a point of contention.

I already do lots of testing before committing stuff.  I can't tell
you how many times I've gone and hung out with friends, while I have a
series of 10 or 30 commits being automatically tested, before ever
committing them.

I currently have over 100 commits in my queue, due to various
different features I'm working on.

* removal of synchronization in ton of places(still under
  development/testing)
* cleanup of stale threads in helper classes at shutdown(reported
  by adrian, altho something I really don't consider a bug, will
  send a separate email soon to discuss)
* cobertura instrumentation in parallel(tested, reading to go)
* major sql parser updates
  * it's more generic.  eventually will be useful for implementing
    a native jdbc driver that is backed by the ofbiz entity engine
  * union support
  * order by function support
* multi-threaded creation of database items(table, fk index,
  declared index)
* multi-threaded data loading
* unix crypt-compatible password hashing
* improve filterProductsInCategory to handle categories with
  thousands(like 40,000) products in them.
* webslinger's commons-vfs implementation
  * non-blocking in all cases
  * only uses the interfaces from commons-vfs, none of the
    implementations
  * COW(actually, overlay with whiteout support)

Some of these changes I started back in February.


Re: concurrent, parallel loading stuff

Posted by BJ Freeman <bj...@free-man.net>.
what is your target for start up.
I am less than one minute on mine.
Not sure breaking an established convention without discussion is a good 
idea.
are you willing to go through all the test and change documentation?

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Adam Heath sent the following on 6/25/2010 11:51 AM:
> BJ Freeman wrote:
>> I am sure you know why but would you enlighten us  as to why this is
>> necessary.
>> Does it break using ofbiz with external tomcat?
>
> Because it makes startup faster.
>
> I did no changes to tomcat, and can't say whether the stuff I've done
> will work with anything other than the tomcat already included.
>
> The other synchronization->concurrent stuff I'm doing in
> framework/base and the like won't have any bearing on the catalina
> workarounds; those will come first.
>
>>
>> Adam Heath sent the following on 6/25/2010 11:20 AM:
>>
>>
>> =========================
>> BJ Freeman
>> http://bjfreeman.elance.com
>> Strategic Power Office with Supplier Automation
>> <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
>> Specialtymarket.com<http://www.specialtymarket.com/>
>>
>> Systems Integrator-- Glad to Assist
>>
>> Chat  Y! messenger: bjfr33man
>> Linkedin
>> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>>
>>
>>> I've got a change to ofbiz startup to make loading of the webapps run
>>> in parallel.  Unfortunately, it's been taking me longer than I'd like
>>> to get working completely.
>>>
>>> Catalina itself is single-threaded when loading the webapps attached
>>> to a particular host.  That fix required me initializing the Context
>>> classes myself before adding to the host.  Unfortunately, that had 2
>>> concurrency bugs in catalina, that I had to hack around.  One was yet
>>> another synchronization.  The other was corruption when catalina tried
>>> to use a global static map to old intermediate data while parsing the
>>> web.xml files.
>>>
>>> However, once I got all those fixed, ofbiz itself stopped the
>>> parallelization.  The startup code called by ControlServlet and
>>> ContextFilter end up calling into synchronized ofbiz blocks, which
>>> effectively stops things from running in parallel.  My fix there is to
>>> remove the synchronized blocks, and switch to more concurrent type algos.
>>>
>>> The latest problem with that, is that FastMap was used to hold the
>>> list of components found.  When things are inserted into a FastMap,
>>> iteration over the values maintains the order that they were added in.
>>>    Switching to ConcurrentHashMap, or ConcurrentLinkedHashMap, gives
>>> things back in an effectively random order.  My plan here is to add
>>> 'dependencies' to the component definitions.  Then, if no dependencies
>>> are specified for a particular ofbiz-component.xml, it'll default to
>>> depending on all currently loaded components.  I already have a
>>> dependency resolver written, to put the components in the proper
>>> order.  This will also allow us to start encoding real dependency
>>> settings into ofbiz.
>>>
>>> I should have this all ready to go by sunday evening.
>>>
>
>


Re: concurrent, parallel loading stuff

Posted by Adrian Crum <ad...@yahoo.com>.
Understood. Thanks.

-Adrian

--- On Fri, 6/25/10, Adam Heath <do...@brainfood.com> wrote:

From: Adam Heath <do...@brainfood.com>
Subject: Re: concurrent, parallel loading stuff
To: dev@ofbiz.apache.org
Date: Friday, June 25, 2010, 12:50 PM

Adrian Crum wrote:
> 2010-06-25 12:32:26,939 (main) [    ContainerLoader.java:50 :INFO ] [Startup] Loading containers...
> 
> ...
> 
> 2010-06-25 12:32:54,251 (main) [ BeanShellContainer.java:102:INFO ] NOTICE: BeanShell service ports are not secure. Please protect the ports
> 2010-06-25 12:32:57,939 (org.ofbiz.service.jms.JmsListenerFactory@14664e4) [ JmsListenerFactory.java:74 :INFO ] JMS Listener Factory Thread Finished; All listeners connected.
> 
> 31 seconds isn't fast enough?

No.  Older ofbiz started in 10s(595296 version).  And that's without
any parallelization.

Faster startup means it's quicker to run tests.  Being able to run
tests faster means they aren't such a burden to run, which means they
will get run more often when code is being developed.

It reduces downtimes when servers need to be restarted.

Hosting multiple ofbiz, where each one takes longer to start, means
that all those times add up.  Multiply that by many companys/users,
many of their own installations, and the time savings are not just
theorhetical.  We've probably got 40 ofbiz installs.

Plus, the synchronization improvements are not just about startup
time.  They improve the system once it is actually up and running.



      

Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> 2010-06-25 12:32:26,939 (main) [    ContainerLoader.java:50 :INFO ] [Startup] Loading containers...
> 
> ...
> 
> 2010-06-25 12:32:54,251 (main) [ BeanShellContainer.java:102:INFO ] NOTICE: BeanShell service ports are not secure. Please protect the ports
> 2010-06-25 12:32:57,939 (org.ofbiz.service.jms.JmsListenerFactory@14664e4) [ JmsListenerFactory.java:74 :INFO ] JMS Listener Factory Thread Finished; All listeners connected.
> 
> 31 seconds isn't fast enough?

No.  Older ofbiz started in 10s(595296 version).  And that's without
any parallelization.

Faster startup means it's quicker to run tests.  Being able to run
tests faster means they aren't such a burden to run, which means they
will get run more often when code is being developed.

It reduces downtimes when servers need to be restarted.

Hosting multiple ofbiz, where each one takes longer to start, means
that all those times add up.  Multiply that by many companys/users,
many of their own installations, and the time savings are not just
theorhetical.  We've probably got 40 ofbiz installs.

Plus, the synchronization improvements are not just about startup
time.  They improve the system once it is actually up and running.

Re: concurrent, parallel loading stuff

Posted by Adrian Crum <ad...@yahoo.com>.
2010-06-25 12:32:26,939 (main) [    ContainerLoader.java:50 :INFO ] [Startup] Loading containers...

...

2010-06-25 12:32:54,251 (main) [ BeanShellContainer.java:102:INFO ] NOTICE: BeanShell service ports are not secure. Please protect the ports
2010-06-25 12:32:57,939 (org.ofbiz.service.jms.JmsListenerFactory@14664e4) [ JmsListenerFactory.java:74 :INFO ] JMS Listener Factory Thread Finished; All listeners connected.

31 seconds isn't fast enough?

-Adrian

--- On Fri, 6/25/10, Adam Heath <do...@brainfood.com> wrote:

> From: Adam Heath <do...@brainfood.com>
> Subject: Re: concurrent, parallel loading stuff
> To: dev@ofbiz.apache.org
> Date: Friday, June 25, 2010, 11:51 AM
> BJ Freeman wrote:
> > I am sure you know why but would you enlighten
> us  as to why this is
> > necessary.
> > Does it break using ofbiz with external tomcat?
> 
> Because it makes startup faster.
> 
> I did no changes to tomcat, and can't say whether the stuff
> I've done
> will work with anything other than the tomcat already
> included.
> 
> The other synchronization->concurrent stuff I'm doing
> in
> framework/base and the like won't have any bearing on the
> catalina
> workarounds; those will come first.
> 
> > 
> > Adam Heath sent the following on 6/25/2010 11:20 AM:
> > 
> > 
> > =========================
> > BJ Freeman
> > http://bjfreeman.elance.com
> > Strategic Power Office with Supplier Automation 
> > <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> > Specialtymarket.com  <http://www.specialtymarket.com/>
> > 
> > Systems Integrator-- Glad to Assist
> > 
> > Chat  Y! messenger: bjfr33man
> > Linkedin
> > <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
> > 
> > 
> >> I've got a change to ofbiz startup to make loading
> of the webapps run
> >> in parallel.  Unfortunately, it's been taking
> me longer than I'd like
> >> to get working completely.
> >>
> >> Catalina itself is single-threaded when loading
> the webapps attached
> >> to a particular host.  That fix required me
> initializing the Context
> >> classes myself before adding to the host. 
> Unfortunately, that had 2
> >> concurrency bugs in catalina, that I had to hack
> around.  One was yet
> >> another synchronization.  The other was
> corruption when catalina tried
> >> to use a global static map to old intermediate
> data while parsing the
> >> web.xml files.
> >>
> >> However, once I got all those fixed, ofbiz itself
> stopped the
> >> parallelization.  The startup code called by
> ControlServlet and
> >> ContextFilter end up calling into synchronized
> ofbiz blocks, which
> >> effectively stops things from running in
> parallel.  My fix there is to
> >> remove the synchronized blocks, and switch to more
> concurrent type algos.
> >>
> >> The latest problem with that, is that FastMap was
> used to hold the
> >> list of components found.  When things are
> inserted into a FastMap,
> >> iteration over the values maintains the order that
> they were added in.
> >>   Switching to ConcurrentHashMap,
> or ConcurrentLinkedHashMap, gives
> >> things back in an effectively random order. 
> My plan here is to add
> >> 'dependencies' to the component definitions. 
> Then, if no dependencies
> >> are specified for a particular
> ofbiz-component.xml, it'll default to
> >> depending on all currently loaded
> components.  I already have a
> >> dependency resolver written, to put the components
> in the proper
> >> order.  This will also allow us to start
> encoding real dependency
> >> settings into ofbiz.
> >>
> >> I should have this all ready to go by sunday
> evening.
> >>
> 
> 


      

Re: concurrent, parallel loading stuff

Posted by Adam Heath <do...@brainfood.com>.
BJ Freeman wrote:
> I am sure you know why but would you enlighten us  as to why this is
> necessary.
> Does it break using ofbiz with external tomcat?

Because it makes startup faster.

I did no changes to tomcat, and can't say whether the stuff I've done
will work with anything other than the tomcat already included.

The other synchronization->concurrent stuff I'm doing in
framework/base and the like won't have any bearing on the catalina
workarounds; those will come first.

> 
> Adam Heath sent the following on 6/25/2010 11:20 AM:
> 
> 
> =========================
> BJ Freeman
> http://bjfreeman.elance.com
> Strategic Power Office with Supplier Automation 
> <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> Specialtymarket.com  <http://www.specialtymarket.com/>
> 
> Systems Integrator-- Glad to Assist
> 
> Chat  Y! messenger: bjfr33man
> Linkedin
> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
> 
> 
>> I've got a change to ofbiz startup to make loading of the webapps run
>> in parallel.  Unfortunately, it's been taking me longer than I'd like
>> to get working completely.
>>
>> Catalina itself is single-threaded when loading the webapps attached
>> to a particular host.  That fix required me initializing the Context
>> classes myself before adding to the host.  Unfortunately, that had 2
>> concurrency bugs in catalina, that I had to hack around.  One was yet
>> another synchronization.  The other was corruption when catalina tried
>> to use a global static map to old intermediate data while parsing the
>> web.xml files.
>>
>> However, once I got all those fixed, ofbiz itself stopped the
>> parallelization.  The startup code called by ControlServlet and
>> ContextFilter end up calling into synchronized ofbiz blocks, which
>> effectively stops things from running in parallel.  My fix there is to
>> remove the synchronized blocks, and switch to more concurrent type algos.
>>
>> The latest problem with that, is that FastMap was used to hold the
>> list of components found.  When things are inserted into a FastMap,
>> iteration over the values maintains the order that they were added in.
>>   Switching to ConcurrentHashMap, or ConcurrentLinkedHashMap, gives
>> things back in an effectively random order.  My plan here is to add
>> 'dependencies' to the component definitions.  Then, if no dependencies
>> are specified for a particular ofbiz-component.xml, it'll default to
>> depending on all currently loaded components.  I already have a
>> dependency resolver written, to put the components in the proper
>> order.  This will also allow us to start encoding real dependency
>> settings into ofbiz.
>>
>> I should have this all ready to go by sunday evening.
>>


Re: concurrent, parallel loading stuff

Posted by BJ Freeman <bj...@free-man.net>.
I am sure you know why but would you enlighten us  as to why this is 
necessary.
Does it break using ofbiz with external tomcat?

Adam Heath sent the following on 6/25/2010 11:20 AM:


=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>

> I've got a change to ofbiz startup to make loading of the webapps run
> in parallel.  Unfortunately, it's been taking me longer than I'd like
> to get working completely.
>
> Catalina itself is single-threaded when loading the webapps attached
> to a particular host.  That fix required me initializing the Context
> classes myself before adding to the host.  Unfortunately, that had 2
> concurrency bugs in catalina, that I had to hack around.  One was yet
> another synchronization.  The other was corruption when catalina tried
> to use a global static map to old intermediate data while parsing the
> web.xml files.
>
> However, once I got all those fixed, ofbiz itself stopped the
> parallelization.  The startup code called by ControlServlet and
> ContextFilter end up calling into synchronized ofbiz blocks, which
> effectively stops things from running in parallel.  My fix there is to
> remove the synchronized blocks, and switch to more concurrent type algos.
>
> The latest problem with that, is that FastMap was used to hold the
> list of components found.  When things are inserted into a FastMap,
> iteration over the values maintains the order that they were added in.
>   Switching to ConcurrentHashMap, or ConcurrentLinkedHashMap, gives
> things back in an effectively random order.  My plan here is to add
> 'dependencies' to the component definitions.  Then, if no dependencies
> are specified for a particular ofbiz-component.xml, it'll default to
> depending on all currently loaded components.  I already have a
> dependency resolver written, to put the components in the proper
> order.  This will also allow us to start encoding real dependency
> settings into ofbiz.
>
> I should have this all ready to go by sunday evening.
>