You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Bindu Wavell <bi...@ziaconsulting.com> on 2013/02/08 23:14:25 UTC
Very bad performance when explicitly paging
I'm not sure if the following is an Alfresco issue or a Chemistry issue, so for now I'm reporting it to both sets of folks :) Of course it's possible that this is not an issue at all. As I said in my previous post I'm testing with CMIS Workbench 0.8 and against Alfresco Enterprise 4.2.1.8.
In Alfresco, I used the following javascript to create 1000 empty documents in a folder:
---
logger.log('STARTING');
for (var i = 1; i <= 1000; i++)
{
document.createFile('test-' + i + '.txt');
}
logger.log('DONE');
---
I'm profiling against the 3.x Web Services bindings using the Groovy Console in CMIS Workbench.
The following script consistently runs in 1-2 seconds:
---
import org.apache.chemistry.opencmis.client.api.*
import groovy.time.*
Date start = new Date();
println start;
OperationContext ctx = session.createOperationContext();
println session.getObjectByPath("/My Project/Forms").getChildren(ctx).getTotalNumItems();
Date stop = new Date();
println stop;
TimeDuration td = TimeCategory.minus( stop, start )
println td
println "DONE";
---
However the following script, where I just set the max items per page, consistently takes 15-17 seconds:
---
import org.apache.chemistry.opencmis.client.api.*
import groovy.time.*
Date start = new Date();
println start;
OperationContext ctx = session.createOperationContext();
// FOLLOWING LINE IS THE NEW CODE
ctx.setMaxItemsPerPage(1000);
// PREVIOUS LINE IS THE NEW CODE
println session.getObjectByPath("/My Project/Forms").getChildren(ctx).getTotalNumItems();
Date stop = new Date();
println stop;
TimeDuration td = TimeCategory.minus( stop, start )
println td
println "DONE";
---
Hope this is useful for folks,
-- Bindu
Re: Very bad performance when explicitly paging
Posted by Bindu Wavell <bw...@ziaconsulting.com>.
Ah, that makes perfect sense. I purchased the chemistry book, but have not read it yet, I'll give it a gander. Thanks for your very helpful response!!!
----------
Bindu Wavell
VP Engineering
Zia Consulting, Inc.
M: +1 720-436-8146
On Sat, Feb 09, 2013 at 12:26 PM, Florian Müller <fm...@apache.org> wrote:
Hi Bindu,
I cannot comment on the absolute numbers. There many factors that can
affect the performance and you seem to have an issue in your setup.
But I can explain the relative difference between your tests.
By default, OpenCMIS fetches batches of 100 objects. Since your test
doesn't iterate through all children, it only fetches one batch.
Your second test forces OpenCMIS to fetch a batch of 1000 objects.
Fetching 10 times more objects results in a 10 times longer response time.
Btw. setMaxItemsPerPage() doesn't do any paging. It's a tuning option.
Paging works like this:
ItemIterable<CmisObject> page = session.getObjectByPath("/My
Project/Forms").getChildren(ctx).skipTo(100).getPage(100);
Florian
P.S.: If you want to learn about CMIS performance tuning have a look at
the book "CMIS and Apache Chemistry in Action"
(http://www.manning.com/mueller/).
> I'm not sure if the following is an Alfresco issue or a Chemistry issue, so for now I'm reporting it to both sets of folks :) Of course it's possible that this is not an issue at all. As I said in my previous post I'm testing with CMIS Workbench 0.8 and against Alfresco Enterprise 4.2.1.8.
>
> In Alfresco, I used the following javascript to create 1000 empty documents in a folder:
>
> ---
> logger.log('STARTING');
> for (var i = 1; i<= 1000; i++)
> {
> document.createFile('test-' + i + '.txt');
> }
> logger.log('DONE');
> ---
>
> I'm profiling against the 3.x Web Services bindings using the Groovy Console in CMIS Workbench.
>
> The following script consistently runs in 1-2 seconds:
>
> ---
> import org.apache.chemistry.opencmis.client.api.*
> import groovy.time.*
>
> Date start = new Date();
> println start;
>
> OperationContext ctx = session.createOperationContext();
> println session.getObjectByPath("/My Project/Forms").getChildren(ctx).getTotalNumItems();
>
> Date stop = new Date();
> println stop;
>
> TimeDuration td = TimeCategory.minus( stop, start )
> println td
>
> println "DONE";
> ---
>
> However the following script, where I just set the max items per page, consistently takes 15-17 seconds:
>
> ---
> import org.apache.chemistry.opencmis.client.api.*
> import groovy.time.*
>
> Date start = new Date();
> println start;
>
> OperationContext ctx = session.createOperationContext();
> // FOLLOWING LINE IS THE NEW CODE
> ctx.setMaxItemsPerPage(1000);
> // PREVIOUS LINE IS THE NEW CODE
> println session.getObjectByPath("/My Project/Forms").getChildren(ctx).getTotalNumItems();
>
> Date stop = new Date();
> println stop;
>
> TimeDuration td = TimeCategory.minus( stop, start )
> println td
>
> println "DONE";
> ---
>
> Hope this is useful for folks,
>
>
> -- Bindu
Re: Very bad performance when explicitly paging
Posted by Florian Müller <fm...@apache.org>.
Hi Bindu,
I cannot comment on the absolute numbers. There many factors that can
affect the performance and you seem to have an issue in your setup.
But I can explain the relative difference between your tests.
By default, OpenCMIS fetches batches of 100 objects. Since your test
doesn't iterate through all children, it only fetches one batch.
Your second test forces OpenCMIS to fetch a batch of 1000 objects.
Fetching 10 times more objects results in a 10 times longer response time.
Btw. setMaxItemsPerPage() doesn't do any paging. It's a tuning option.
Paging works like this:
ItemIterable<CmisObject> page = session.getObjectByPath("/My
Project/Forms").getChildren(ctx).skipTo(100).getPage(100);
Florian
P.S.: If you want to learn about CMIS performance tuning have a look at
the book "CMIS and Apache Chemistry in Action"
(http://www.manning.com/mueller/).
> I'm not sure if the following is an Alfresco issue or a Chemistry issue, so for now I'm reporting it to both sets of folks :) Of course it's possible that this is not an issue at all. As I said in my previous post I'm testing with CMIS Workbench 0.8 and against Alfresco Enterprise 4.2.1.8.
>
> In Alfresco, I used the following javascript to create 1000 empty documents in a folder:
>
> ---
> logger.log('STARTING');
> for (var i = 1; i<= 1000; i++)
> {
> document.createFile('test-' + i + '.txt');
> }
> logger.log('DONE');
> ---
>
> I'm profiling against the 3.x Web Services bindings using the Groovy Console in CMIS Workbench.
>
> The following script consistently runs in 1-2 seconds:
>
> ---
> import org.apache.chemistry.opencmis.client.api.*
> import groovy.time.*
>
> Date start = new Date();
> println start;
>
> OperationContext ctx = session.createOperationContext();
> println session.getObjectByPath("/My Project/Forms").getChildren(ctx).getTotalNumItems();
>
> Date stop = new Date();
> println stop;
>
> TimeDuration td = TimeCategory.minus( stop, start )
> println td
>
> println "DONE";
> ---
>
> However the following script, where I just set the max items per page, consistently takes 15-17 seconds:
>
> ---
> import org.apache.chemistry.opencmis.client.api.*
> import groovy.time.*
>
> Date start = new Date();
> println start;
>
> OperationContext ctx = session.createOperationContext();
> // FOLLOWING LINE IS THE NEW CODE
> ctx.setMaxItemsPerPage(1000);
> // PREVIOUS LINE IS THE NEW CODE
> println session.getObjectByPath("/My Project/Forms").getChildren(ctx).getTotalNumItems();
>
> Date stop = new Date();
> println stop;
>
> TimeDuration td = TimeCategory.minus( stop, start )
> println td
>
> println "DONE";
> ---
>
> Hope this is useful for folks,
>
>
> -- Bindu