How is your experience with the OutSystems Community?
14
Views
3
Comments
ODC External Library - high latency in call any action .NET library

Hi all, I need to call action from ,NET library in loop and found total time for whole operation is too long.
After quick troubleshooting I noticed that any call to any dummy method in .NET running very slow:
(finally testing on trivial method, just returning a the static string)
10 calls: ~3sec
100 calls: ~30 sec

Originally library was on .NET8, then I changed it to .NET 10. Result is same.

What could be a reason of such slowness?

Thank you in advance

UserImage.jpg
Stanislav Ploschansky

I just found in documentation: 
> Latency: Since an HTTPS call is made each time a server action in an external library is called, a small amount of latency is introduced in the execution time. Minimizing the number of calls to external libraries and batching operations where possible can help mitigate the impact of this latency.

Oh... 0.3 sec per call is not a small latency at all. 
is there any way to develop a real library, on any language, which will work inside ODC app like it was in OS11? 

2026-06-05 12-38-17
Eduardo Jauch

Hello @Stanislav Ploschansky 

I don't think there is a workaround for this, as it is a platform architecture decision. 

I think the best you can do here is to move the looping to your external code, passing the list to it instead of calling the external code for every iteration. 

Cheers!

2023-12-26 10-35-28
OutSystems Neo
Staff
AI Generated

The most likely cause isn’t .NET itself, but the way ODC is invoking your .NET library on each call.

In OutSystems Developer Cloud, every call from an action to a custom .NET library crosses a process boundary (OutSystems runtime → your library). If you call that library in a tight loop (100 times, 1000 times, …), you’re paying the overhead of:

  • Parameter serialization / deserialization
  • Context setup (per call)
  • Inter‑process / inter‑service communication

Even if the method is trivial (returns a static string), that call overhead doesn’t disappear, so the per‑call cost dominates and you see the near‑linear scaling:

  • ~10 calls → ~3s
  • ~100 calls → ~30s

That pattern strongly suggests it’s not “slow .NET code”, but “expensive integration boundary”.

What you can do about it

  1. Batch work in the .NET library instead of looping in OutSystems

    Instead of:

    For each item:
        Call MyDotNetLib.DummyMethod(Item)
    

    Refactor to:

    • Pass the whole list / structure from OutSystems into one .NET method.
    • Do the loop and processing inside .NET.
    • Return the combined result.

    That turns 100 slow calls into 1 call, where the overhead is paid only once.

  2. Minimize data passed on each call

    If you must call the library multiple times:

    • Keep parameter sets as small as possible (especially large structures or lists).
    • Avoid passing big binaries or JSON blobs per call; if needed, compress or chunk them and still prefer batching.
  3. Check for extra overhead in your implementation

    Inside your .NET method, confirm there’s no hidden cost per call, such as:

    • Creating heavy objects (e.g., HttpClient, DB connections) on every invocation.
    • Doing I/O (logging to disk, network calls, etc.) per call.
    • Using reflection, dynamic loading, or expensive configuration initialization each time.

    Move those to some sort of static / cached initialization if possible.

  4. Consider OutSystems native alternatives

    For things OutSystems can handle natively (string manipulation, math, simple data shaping, HTTP calls, etc.), it’s usually faster and simpler to implement directly in ODC actions than jumping into a custom .NET library, especially in loops.

  5. Measure per‑call cost

    Add timing inside the .NET method:

    var start = DateTime.UtcNow;
    // trivial work
    var end = DateTime.UtcNow;
    

    Compare:

    • Total time measured inside the library (should be near zero for a static string).
    • Total time measured on the OutSystems side for the same number of calls.

    If the library time is negligible and the OutSystems side is slow, that confirms the overhead is at the integration boundary, not in your .NET logic.


In summary: the slowness is almost certainly due to calling the .NET library many times from OutSystems, not the .NET runtime or your trivial method. Redesign to do more work per call (batching) and keep calls few and coarse‑grained; that’s the main way to bring total time down in ODC when using custom .NET libraries.

This answer was AI-generated. Please read it carefully and use the forums for clarifications
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.