Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Add new profling options for Facebook/hhvm #28

Merged
merged 1 commit into from
Apr 21, 2015

Conversation

paulbiss
Copy link
Contributor

Summary: This is commit adds a hand full of convenience options for:

  • Enabling/disabling the FileCache and RepoAuthoritative mode during profiling
  • Generating TCDumps (optionally of the top functions/translations)
  • Profiling bytecodes (as opposed to PHP functions)
  • Keeping the server on online after profiling is complete
  • Running repo-mode with AllVolatile enabled (hoisting is technically broken...sigh)
  • Adjusting the PCRE caching scheme, and cache size
  • Dumping the contents of the PCRE cache
  • Interpreting all pseudomains (guard relaxation is broken for pseudomains...sigh)
  • fbcode option to use an fbcode build of hhvm/tc-print (the latter being for TCDumps)

The following changes were also made:

  • Run 300 serial warmup requests
  • Run one round of parallel requests before benchmarking
  • Write the pid file path to nginx.conf (useful for testing)
  • Remove the check for connectivity in wordpress (was unnecessary, and proxies suck)
  • Remove the -k option for timeout (not supported on devservers)

The following is still broken on devservers:

  • Cannot create databases with MyISAM tables (not sure of the best fix but we do need to fix this)

The following features would be useful in a followup PR:

  • Option to run linux perf tool
  • Option to run rollup tool (integrated with fbcode option)
  • Option to dump repo
  • Option to dump file-cache

The additional warmup time was added after inspecting the tc-filling behavior and discovering that tc size was still dramatically increasing after 50 warmup requests. The additional serial warmup requests ensure near optimal tc layout, while the extra complete run of parallel requests is for a handful of frameworks that continue to substantially JIT even after a high volume of single threaded requests (mostly in conjunction with broken pseudomain JITing). While inconvenient the added warmup should ensure better consistency (this was certainly observed in testing). It's also particularly important in repo-auth mode where hot functions are JITed into Ahot after appropriate profiling which may further delay warmup.

Test Plan: Tested all new options, ran hh_client

$this->tc_toptrans = array_key_exists('dump-top-trans', $o);
$this->tc_topfuncs = array_key_exists('dump-top-funcs', $o);
$this->pcredump = array_key_exists('dump-pcre-cache', $o);
$this->profBC = array_key_exists('profBC', $o);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FB standard is:

  • locals are under_scored
  • members are camelCased

Hopefully I was consistent, but these new ones aren't even with each other.

@paulbiss paulbiss force-pushed the perf-options branch 2 times, most recently from d70b1ba to 41ffdb8 Compare April 20, 2015 15:45

invariant(is_dir($sourceRoot), 'Could not find valid source root');

$files = shell_exec("cd $sourceRoot && find . -type f");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recursiveiteratoriterator + recursivedirectoryiterator would be nice

@fredemmott
Copy link
Contributor

Given how many shell_exec() this adds, probably worth adding a helper that takes string $cmd, Vector args.

@fredemmott
Copy link
Contributor

Can you force-push a rebase+squash, ideally add the shell_exec() function, then I'll merge this?


// Pause once benchmarking is complete to allow for manual inspection of the
// HHVM or PHP process.
public bool $waitAtEnd = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for adding this!

fredemmott added a commit that referenced this pull request Apr 21, 2015
Add new profling options for Facebook/hhvm
@fredemmott fredemmott merged commit e0a6d33 into facebookarchive:master Apr 21, 2015
@fredemmott
Copy link
Contributor

Going to revisit --i-am-not-benchmarking, this breaks its' purpose.

fredemmott added a commit that referenced this pull request Apr 22, 2015
- require --i-am-not-benchmarking as they pretty much all have a potential perf impact
- removing the alignment as it's inconsistent with the rest, and can't be maintained in the future while preserving git blame.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants