Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

How to deal with functions that runs in parallel? #27

Open
goenning opened this issue Jul 14, 2016 · 1 comment
Open

How to deal with functions that runs in parallel? #27

goenning opened this issue Jul 14, 2016 · 1 comment

Comments

@goenning
Copy link

Hello,

On Node.js webapps it's very common to have async functions running in parallel, for example, I can send a HTTP request to two endpoints at the same time and when I got the response from both, I render the view.

app.get('/', (req, res) => {
  async.parallel([
    request.bind(this, 'http://jsonip.com'),
    request.bind(this, 'http://jsonip.com') //just suppose it's a different endpoint
  ], function(err, results) {
    res.render('index');
  });
});

MiniProfiler is correctly recording timing for both requests, but the UI is showing the sum of durations.

I want to make a PR for this, but first I'd like to get you opinion on what should be done here.

Using the example above, the correct shown duration should be 429.9ms.

mp3

We can complicate it even more with a scenario like this:
Request 1 - Started at 10ms with duration of 400ms
Request 2 - Started at 200ms with duration of 300ms.

@maddyblue
Copy link
Member

miniprofiler doesn't do parallel stuff well at all. It was initially written years ago for C# where that wasn't really a thing. We should use gantt charts like app stats does (https://googleappengine.blogspot.com/2010/03/easy-performance-profiling-with.html). This would require a fair amount of work on the frontend. I think the backends could stay the same.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants