Our pure JavaScript Scheduler component


Post 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


Post by mats »

Is it the same for you if you try 5.3?


Post by Exigo »

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


Post 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.

Best regards,
Márcio


Post 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,
      }
    );
  }
}
Attachments
example_of_alot_of_data.txt
(5.88 KiB) Downloaded 17 times

Post 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.


Post 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! :)

Best regards,
Márcio


Post 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 19 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 263 times

Post 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


Post 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);

Post Reply