-
Notifications
You must be signed in to change notification settings - Fork 339
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
Slow initial startup serializer/deserializer #2477
Comments
The slow first call could be caused by the initial startup of the serializer/deserializer. This should normally take milliseconds, but there could be something in the environment that slows that process down. |
Let's see it we can isolate the problem. Can you replace the FhirClient calls with a simple serializer/deserializer call? Like the code on top of this page: https://docs.fire.ly/projects/Firely-NET-SDK/parsing/poco-parsing.html Also: which version of the SDK are you using? |
Note from Behrouz: I managed to solve the issue. In Program.cs
In WarmUpHttpClients method (A fake request):
|
One more possible thing is that the first thing the FhirClient does (and it does this once!) is check the version of the server it is communicating with. If this is a slower server or connection (the CapabilityStatements can be HUGE), than this is certainly a problem. There is a FhirClient setting to not perform this check - @Sieuwkje this might be worth checking out if this is still relevant. Oteherwise, it's hard for us to reproduce, and I am positively sure that if this was a general problem, we would get many more reports about this issue. |
This is more likely that loading of all the classmapping objects via the ModelInspector through reflection in the serializer - which is only done once. var patString = new Patient().ToXml(); Maybe the httpclient also could use some warming, but the preparation in the ModelInspector has taken its time in the past. |
@Sieuwkje-firely, is this still an issue? Otherwise, I am going to close it. |
Sorry, yes this issue can be closed :) |
Note
Created for Behrouz Rad who emailed this issue to the Firely Server mailbox
Describe the bug
I use the SDK in a .NET Core Web API Service app that runs on an EC2 amazon instance.
The service runs during the startup of the server. When the service receives the very first request, any methods of the SDK like SearchAsync or CreateAsync takes nearly 6 seconds to be completed.
From the second request on, these methods run fast.
May you have any idea on improving the first call to the APIs?
Additional context
I tried different techniques like compilation with R2R mode or using IHttpClientFactory for FhirClient and disabling IPV6, but no chance.
The text was updated successfully, but these errors were encountered: