microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
722 stars 242 forks source link

Number Sequence is very slow on Cloud environments #7678

Closed Drakonian closed 4 months ago

Drakonian commented 4 months ago

Please include the following with each issue:

1. Describe the bug NumberSequence is slowest way to get next number in Cloud Business Central. Each NumberSequence.Next take 3ms image

In my analysis, I came to the conclusion that the issue is a slow hard disk for Cloud Business Central.

One of the possible ways to improve performance it's to add CACHE parameter upon NumberSequence.Insert In this case we can reduce number of IOs for SQL Server NumberSequence object

More information in article https://vld-nav.com/number-generation-performance-cloud

I don't have partner account, so if you think this isn't the right place, I won't be able to create a ticket.

2. To Reproduce Steps to reproduce the behavior:

Create number sequence and call it in loop in Cloud Business Central.

NumberSequence.Insert('TestPerformance');
for i := 1 to 100000 do
    NumberSequence.Next('TestPerformance');

3. Expected behavior It should work at least faster than Rec.Modify()/UPDATE statement in AL/SQL.

4. Actual behavior It's super slow.

5. Versions:

Latest available Cloud Business Central

kalberes commented 4 months ago

We cannot help you if you do not have a partner account. Try with the repos for AL developers (e.g the repo for the system application) . Maybe they have better ideas and experience. Nevertheless it is not for this repo.