# APM Time Complexity Questions

**URL:** <https://discuss.elastic.co/t/apm-time-complexity-questions/200744>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [September 23, 2019, 7:33pm UTC](https://discuss.elastic.co/t/apm-time-complexity-questions/200744 "2019-09-23T19:33:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LordMathis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lordmathis/32/55044_2.png) [@LordMathis](https://discuss.elastic.co/u/LordMathis)\
**Post date:** [September 23, 2019, 7:33pm UTC](https://discuss.elastic.co/t/apm-time-complexity-questions/200744/1 "2019-09-23T19:33:01Z")

</div>

Kibana version: 7.3

Elasticsearch version: 7.3

APM Server version: 7.3

APM Agent language and version: C#

Hey APM community,

Are there some more exact metrics on how much time complexity APM adds to a particular program?

I ran some pretty rudimentary tests on my machine and was wondering if there are some more official numbers. My basic test was just running the same function, one with APM off:

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/d/5d756bcdf7d2a8e468848e1f3e400427b7e8f45e.png)

And one with it on:

![image](https://us1.discourse-cdn.com/elastic/original/3X/f/d/fde2358fa1e13b5491afce75f1e7d179bebef43a.png)

The function itself is really just designed to take up some time.

The number differences were this:

With it off:  
Elapsed Time: 5.5873448 seconds  
Elapsed Time: 5.7728854 seconds  
Elapsed Time: 5.7654855 seconds  
Elapsed Time: 5.7190262 seconds  
Elapsed Time: 5.9011684 seconds

With it on:  
Elapsed Time: 13.7355453 seconds  
Elapsed Time: 12.0428342 seconds  
Elapsed Time: 13.19944 seconds  
Elapsed Time: 12.2065772 seconds  
Elapsed Time: 13.244451 seconds

Which seems like a relatively steep increase. Obviously this isn't perfectly representative of the actual code we'd be running but it would be a lot more complicated to write code that would be closer to the real code, so I was hoping the APM community might have more metrics on this available.

---

<div class="post-metadata">

**Author:** ![Sergey\_Kleyman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey_kleyman/32/39333_2.png) [@Sergey\_Kleyman](https://discuss.elastic.co/u/Sergey_Kleyman)\
**Post date:** [September 25, 2019, 5:14am UTC](https://discuss.elastic.co/t/apm-time-complexity-questions/200744/2 "2019-09-25T05:14:45Z")

</div>

Hi @LordMathis,

Unfortunately we still didn't get to measuring .NET Agent performance overhead for the representative use cases - we have an [issue for this task](https://github.com/elastic/apm-agent-dotnet/issues/28) in the backlog and I hope we will get to it soon.

Regarding your particular example - I would still advise measuring a use case that is closer to your actual application code - at least this is what we plan to do for the planned benchmarks.

---

<div class="post-metadata">

**Author:** ![karlpokus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karlpokus/32/48868_2.png) [@karlpokus](https://discuss.elastic.co/u/karlpokus)\
**Post date:** [September 26, 2019, 7:45pm UTC](https://discuss.elastic.co/t/apm-time-complexity-questions/200744/3 "2019-09-26T19:45:56Z")

</div>

@LordMathis Do you really think your benchmark is fair? In the second iteration (with the apm agent enabled) you do lots of system calls to stdout. I count 4 of them before you call `Watch.Stop()`. I/O is not cheap and would likely increase the elapsed time you posted.

---

<div class="post-metadata">

**Author:** ![LordMathis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lordmathis/32/55044_2.png) [@LordMathis](https://discuss.elastic.co/u/LordMathis)\
**Post date:** [September 27, 2019, 5:10pm UTC](https://discuss.elastic.co/t/apm-time-complexity-questions/200744/4 "2019-09-27T17:10:30Z")

</div>

This is a good point. Didn't think of this!

---

<div class="post-metadata">

**Author:** ![karlpokus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karlpokus/32/48868_2.png) [@karlpokus](https://discuss.elastic.co/u/karlpokus)\
**Post date:** [September 27, 2019, 6:50pm UTC](https://discuss.elastic.co/t/apm-time-complexity-questions/200744/5 "2019-09-27T18:50:17Z")

</div>

@LordMathis No worries. May I suggest you re-run your tests and update this thread with the result? I'm curious about the (actual) overhead too 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 18, 2019, 2:50pm UTC](https://discuss.elastic.co/t/apm-time-complexity-questions/200744/6 "2019-10-18T14:50:20Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
