Page 1 of 2

[ANGULAR] Slow down in syncing big requests

Posted: Mon Mar 13, 2023 3:40 pm
by Exigo

Hello

We've experienced some slow downs with syncing to the backend. We've pinpointed the error to the upgrade between 5.2.7 and 5.2.8.

When using

ProjectModel.sync()

we've gone from speeds of:
1297 ms to
12582 ms

When creating around 300 events and 300 dependencies. Please note that the response time from out server is around 500 ms in both of these instances.

I've found that in the the class AbstractCrudManagerMixin.js

async internalOnResponse(request, responseText, fetchOptions) {
	...
	await me.applyResponse(request, response, options); // Line 1147 on 5.2.8
	...
}

It seems that the slowdown happens here. Atleast if I put a break point before and after it takes around 10 seconds to hit the second breakpoint. Hope you can help/reproduce.

Cheers
Andreas @ Exigo


Re: [ANGULAR] Slow down in syncing big requests

Posted: Mon Mar 13, 2023 4:50 pm
by mats

Is it the same for you if you try 5.3?


Re: [ANGULAR] Slow down in syncing big requests

Posted: Mon Mar 13, 2023 4:59 pm
by Exigo

Hey Mats. I also tried to upgrade to 5.3. Same issue.


Re: [ANGULAR] Slow down in syncing big requests

Posted: Mon Mar 13, 2023 8:31 pm
by marcio

Hey Andreas,

Would be possible to provide a test case with minimum configuration about how are you creating the events and dependencies? Perhaps creating a custom project based on a demo for us to check and analyze your case and the performance of that ProjectModel.sync() function.


Re: [ANGULAR] Slow down in syncing big requests

Posted: Tue Mar 14, 2023 12:56 pm
by Exigo

I tried on this with attached data, but it does not handle dependencies.

https://bryntum.com/products/schedulerpro/examples-scheduler/crudmanager/

You can see how i create a lot of events further down:

    for (let i = 0; i < 300; i++) {
	  const firstEvent = scheduler.crudManager.eventStore.last;
      scheduler.crudManager.eventStore.add({ startDate: new Date(), duration: 24, durationUnit: "h" });
	  const secondEvent = scheduler.crudManager.eventStore.last;

  if (firstEvent) {
    scheduler.crudManager.dependencyStore.add(
      {
        from: firstEvent.id,
        to: secondEvent.id,
      }
    );
  }
}

Re: [ANGULAR] Slow down in syncing big requests

Posted: Tue Mar 14, 2023 1:42 pm
by Exigo

Hey Again. After some tests in our own code it seems that dependencies is not important. It seems to happen when syncing a lot of tasks. I'll see if I can pinpoint it and make a case, cause it does seem like it is something in our code that is not making nice with the 5.2.8 version.


Re: [ANGULAR] Slow down in syncing big requests

Posted: Tue Mar 14, 2023 3:15 pm
by marcio

Hello,

We'll be waiting for your test case to help us check this issue and pay attention if other users report the same performance issue on sync! :)


Re: [ANGULAR] Slow down in syncing big requests

Posted: Wed Mar 15, 2023 4:52 pm
by Exigo

So I managed to reproduce it in the example:

https://bryntum.com/products/schedulerpro/examples-scheduler/crudmanager/

with:

test_database_sync_bryntum.js
(5.93 KiB) Downloaded 22 times

If you don't add it with a resourceID the sync is 1000ms. If you do, it it is +10000ms. See gif

sync_slow_with_resourceID.gif
sync_slow_with_resourceID.gif (4.35 MiB) Viewed 401 times

Re: [ANGULAR] Slow down in syncing big requests

Posted: Wed Mar 15, 2023 5:35 pm
by Exigo

I've also tried with

assignmentStore: {}

and

const newEvent = new EventModel({name,  startDate: firstEvent.startDate, duration: 24, durationUnit: "h"});
				  scheduler.project.assignmentStore.add({ eventId: newEvent.id, resourceId: firstResource.id})

Same result with +10000ms sync time


Re: [ANGULAR] Slow down in syncing big requests

Posted: Thu Mar 16, 2023 6:38 pm
by mats

This is not how you should be creating events:

for (let i = 0; i < 300; i++) {
					const name = 'test ' + i;
				  const newEvent = new EventModel({name,  startDate: firstEvent.startDate, duration: 24, durationUnit: "h", resourceId: firstResource.id});
				  scheduler.project.eventStore.add(newEvent);
				}

every add will cause a redraw. Add events to an array and do one eventStore.add call and it will work fast.

const events = []
for (let i = 0; i < 300; i++) {
					const name = 'test ' + i;
				  const newEvent = new EventModel({name,  startDate: firstEvent.startDate, duration: 24, durationUnit: "h", resourceId: firstResource.id});
				  events.push(newEvent)
				}
				scheduler.project.eventStore.add(events);