[Flow] Updating Object with lots of related objects takes really long
Alexander Berl
a.berl at outlook.com
Fri Jun 13 14:33:07 CEST 2014
Bounded Contexts is a general pattern in Domain Driven Design, there's
lots of information out on the web.
A core entry point is probably the excerpt from Fowler:
http://martinfowler.com/bliki/BoundedContext.html
However, I'm not sure if that solves your problem, as you stated in your
original question: "if an object has lots of related objects (1:n
relationship)"
That implies that there is only one relation, but the relation itself
contains a huge amount of related objects, e.g. 1:1000 or so.
In that case, bounded contexts are of no help, as there is nothing much
to seperate into own contexts.
There's too little information on the specific use case, but some points
to look for:
- disable persistence validation on subobjects (use ValidationGroups for
that)
- when related entities rarely change: make them an aggregate root
themself, so they are not persisted with the main object automatically
- if all related objects are changed and need persistence every time,
try an alternative way to persist: see
http://www.doctrine-project.org/2009/08/07/doctrine2-batch-processing.html
or instead of going through the whole ORM use native query and e.g. LOAD
DATA INFILE
In all cases, do benchmarks before and after every optimization try to
be sure to really do something useful instead of just complicating your
business logic without benefit.
Regards,
Alexander
Am 12.06.2014 17:37, schrieb David Sporer:
> But does it also validate every related object on Update?
>
> Dominique, do you have an example for the bounded context you're suggesting?
>
> Thanks
> David
>
>
> 2014-06-12 13:36 GMT+02:00 Carsten Bleicker <carsten at bleicker.de>:
>
>> Dont know exactly, but isnt flow running validation on each object?
>>
>> Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Persistence/Doctrine/PersistenceManager.php:88
>> Maybe this one is also a bottleneck?
>>
>>
>>
>> Am 12.06.2014 um 13:30 schrieb Dominique Feyer <dfeyer at ttree.ch>:
>>
>>> That’s not exactly Flow related. The performance problem come from the
>> ORM (Doctrine) and maybe the persistance layer (index update, I/O, …).
>>>
>>> To improve performance on your case, maybe you can apply more strongly
>> some Domain Driven Design principle, like bounded context. Sometime you can
>> remove the strong relation between objects and use two different context
>> with simple model to replace your big model. Bounded context can have a
>> lots of advantage, but can also have some side effect like « over
>> engineered »
>>>
>>>
>>> --
>>> ttree sàrl
>>> Dominique Feyer
>>> Rue du Valentin 34 et demi
>>> CH - 1004 Lausanne
>>> +41 21 312 36 35
>>> dfeyer at ttree.ch
>>> ttree.ch - @ttreeagency - plan d’accès
>>>
>>> Le 12 juin 2014 à 12:47:48, David Sporer (david.sporer at gmail.com) a
>> écrit:
>>>
>>> Hi,
>>>
>>> I've noticed that if an object has lots of related objects (1:n
>>> relationship) a update to this object takes really long.
>>> Are there any tips on how to speed things up?
>>>
>>> Regards
>>> David
>>> _______________________________________________
>>> Flow mailing list
>>> Flow at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
>>> _______________________________________________
>>> Flow mailing list
>>> Flow at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
>>
>>
>> _______________________________________________
>> Flow mailing list
>> Flow at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
>>
More information about the Flow
mailing list