Skip to main content

Hi,

Our project uses Cognite Function scheduling to deploy data to CDF, and we struggle to understand what the “Duration” of a Cognite Function actually represents. I have attached a screenshot showing one of our function calls, printing the duration of various function from our source code. As you see the duration of our source code takes 2+ minutes, but the call of the function itself takes less than 2 minutes (start at 7:40 and end at 7:41). Is there a distinction here between what is actually run in the backend, and overhead in terms of instantiating a call to the Cognite Function? Can anyone explain the apparent deviations?

 

Thanks.

 

 

Also, our function counting alarms uses multithreading for parallel processing. Running locally takes significantly shorter time than Cognite Function calls. Have anyone experienced runtime issues when using multithreading together with Cognite Functions?


Inside CDF Functions, you can click on the function details tab and see that each function only runs on one core and 1.5 GB RAM so I don’t think parallel processing will work on CDF Functions. 


Hi @Vetle Nevland,

We are following up to see whether you're satisfied with the responses you've received? 


@APSHANKAR Sagar Thanks for answering. Sorry for delayed response, just returned from vacation. 

To clarify, we are counting and retrieving CDF Events concurrently using multiple threads with Python’s 

ThreadPool

class (single or multiple cores), not parallel processing with multiple cores. Can Cognite Functions handle this? 

Also, I still don’t understand why the Cognite Function executes for less than 2 minutes, while the backend code runs for more than 2 minutes. I see that multithreading is a known issue. Could this perhaps explain the observed deviations?


Hello @Vetle Nevland ! 

I work with the functions-team, so I can provide some insight here. 
To answer your questions:

  1. Yes, using threads should be no problem.
  2. The “duration” measures the execution time of your `handle`-function in addition to any overhead incurred by our backend. This overhead includes the time it takes for various messages to propagate around our backend, as well as any scaling of compute resources. 

Hope this helps! Let me know if you have any additional questions!

 

// Ivar Stangeby

 

 


Reply