-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(SCIM): optimize performance #568
Conversation
result.FlatAttributes = filteredAttrs.ToList(); | ||
return result; | ||
} | ||
|
||
representations = representations.Include(r => r.FlatAttributes).ThenInclude(s => s.SchemaAttribute); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was moved to EFSCIMRepresentationQueryRepository
a0da371
to
d073474
Compare
} | ||
|
||
public virtual IEnumerable<RepresentationSyncResult> Sync(string resourceType, SCIMRepresentation oldScimRepresentation, SCIMRepresentation newSourceScimRepresentation, string location, SCIMSchema schema, bool updateAllReferences = false, bool isScimRepresentationRemoved = false) | ||
public virtual async Task<List<RepresentationSyncResult>> Sync(string resourceType, SCIMRepresentation oldScimRepresentation, SCIMRepresentation newSourceScimRepresentation, string location, SCIMSchema schema, bool updateAllReferences = true, bool isScimRepresentationRemoved = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased my code which originated from 4.0.2 using master
, and I see that you made some changes like false
-> 'true
.
@thabart should I change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the master
branch, by default, the field updateAllReferences
is equals to false
and not to true
:
SimpleIdServer/src/Scim/SimpleIdServer.Scim/Helpers/RepresentationReferenceSync.cs
Line 18 in ed07717
public class RepresentationReferenceSync : IRepresentationReferenceSync |
The field must be false
} | ||
|
||
foreach (var attributeMapping in kvp.Where(r => !r.IsSelf)) | ||
{ | ||
result = new RepresentationSyncResult(); | ||
var targetSchema = mappedSchemas.First(s => s.ResourceType == attributeMapping.TargetResourceType && s.Attributes.Any(a => a.Id == attributeMapping.TargetAttributeId)); | ||
var targetSchema = targetSchemas.First(s => s.ResourceType == attributeMapping.TargetResourceType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same about this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This portion of code has been updated by pull request #557.
There was an issue during the resolution of the attribute present in a custom schema.
You are welcome to retain this change :)
var targetAttribute = targetSchema.GetAttributeById(attributeMapping.TargetAttributeId); | ||
var sourceAttribute = sourceSchema.GetAttributeById(attributeMapping.SourceAttributeId); | ||
var sourceAttribute = schema.GetAttributeById(attributeMapping.SourceAttributeId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark
2d821a1
to
d8acd2f
Compare
d8acd2f
to
89fb08d
Compare
Hello, Firstly, thank you for your pull request. Are you sure that the I'm okay with using .NET version 7, but please remember to upgrade the other projects that reference this project. Unfortunately, the solution is not compiling. Could you please fix the issues? Thank you. |
Hello @simpleidserver
Kind regards |
var targetSchema = targetSchemas.Single(s => s.Name == propagatedAttribute.TargetResourceType); | ||
var sourceSchema = targetSchemas.Single(s => s.Name == propagatedAttribute.SourceResourceType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Unfortunately, the unit tests are not functioning properly :( Don't forget to include the changes made on the Additionally, for my curiousity :), do-you have a link to documentation that explains why the I have checked the performance, and there is an improvement in memory usage! Ty again for your contribution. |
50bca19
to
7b0baf8
Compare
7b0baf8
to
8a4f81e
Compare
Fix the UTs
…4-flomin-optimize
Hello @danflomin , I fixed the UTs and also issues in the KR, SID |
@@ -2,11 +2,13 @@ | |||
<PropertyGroup> | |||
<TargetFramework>netstandard2.0</TargetFramework> | |||
<Description>SCIM2.0 implementation.</Description> | |||
<LangVersion>latest</LangVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because some changes in the pull request are not supported by previous c# version for example ??=
Hello I will try to find a good explanation for the issue with the yield. Thank you for your fixes, I went over most of it and it looks fine. I will let you know once done. Kind regards |
Hello, do you have ETA of this PR? Kind regards. |
In this PR the main changes relate to using async overloads of DB queries.
Using async overloads is considered as the good practice in asp.net, and after a benchmark I conducted, these changes improved the performance by several magnitudes.
Also, the usage of
yield
in DB queries is considered to be less efficient with respect to network.Another performance improvements introduced in here:
ResolveChildren
andResolveParents
functions, queried the same representations multiple times, so I added a check that makes sure that each representation is queried only once.AsNoTracking
behavior which improves performance.