krisselden / ember-macro-benchmark

Benchmark recording of an ember app with running with 2 versions of Ember.
25 stars 9 forks source link

Add section describing how to generate a valid HAR file #13

Closed rondale-sc closed 2 years ago

rondale-sc commented 7 years ago

Using Firefox because with persistent logging history on in Chrome only request history is persisted not response history. This means the HAR file doesn't have the ifnormation necessary for EMB to work correctly:

See more here:

https://bugs.chromium.org/p/chromium/issues/detail?id=118971 https://bugs.chromium.org/p/chromium/issues/detail?id=116990

krisselden commented 7 years ago

I've not had an issue with generating a HAR with Chrome, you have to right click on the table in the Network tab and select "Save HAR with Content"

krisselden commented 7 years ago

I see, you are doing the recording with the about:blank redirect enabled, I usually don't do that.

rondale-sc commented 7 years ago

Oh, I see. I had assumed that was what chrome-tracing used to determine the end of the run. Is that not the case?

krisselden commented 7 years ago

@rondale-sc it is, but you don't need to use the redirect for making the recording, just for doing the trace.

rondale-sc commented 7 years ago

@krisselden Oh, that makes sense. Would it make sense for me to add a blurb about that and also instructions for Chrome?

rondale-sc commented 7 years ago

Updated this PR to better reflect this discussion. Though, as a side-note on my client's project I noticed that Chrome HAR file saved to invalid json. Whereas firefox did not. Very strange.

chrisgame commented 7 years ago

@rondale-sc @krisselden i thought the ?perf.tracing query param was required in the recording and so was the about:blank redirect as these are in the js asset that is captured in the recording. If i don't include the ?perf.tracing query param it it causes a 404 when running the benchmark as the .har file doesn't contain a request for the base url that includes the query param. It's only the ember version that gets swapped out right? The app code that is used comes from the .har file?

I have also modified the config.json slightly to include a url as the app i want to benchmark doesn't serve anything interesting on the root. The page i want to benchmark is actually a few levels deeper. Do you think this is a change worth adopting? I can imagine there are few apps out there with similar setups

chrisgame commented 7 years ago

Also i'm interested to know how you go about capturing your .har files. I have found chrome doesn't reliably capture the payload of responses, so much so that even after a few runs i couldn't get all the requests to come back with responses. I stopped short of editing a .har file together. Firefox seems to capture everything correctly but when run yarn run serve i get a error parsing the vendor.js (which is admittedly a masssive file on my project)

rondale-sc commented 6 years ago

@chrisgame I had the same trouble re: chrome response problems. You can generate the har files in Firefox and that has been considerably more reliable for me.

Once you have Firefox install:

rondale-sc commented 6 years ago

@chrisgame As for your other question. I believe that you do need the redirect and qp in your recording.

The ember version is swapped out under certain circumstaces (configurable) and otherwise you can sub out your entire dist, iirc. Those config options should be documented in the README. Following what is being substituted can be done by putting some consoles into the server.ts file before you run. Troubleshooting, at least in my experience, is a lot of source reading and some trial-and-error.