Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete tester #28

Merged
merged 60 commits into from
Jan 6, 2016
Merged

Autocomplete tester #28

merged 60 commits into from
Jan 6, 2016

Conversation

orangejulius
Copy link
Member

This is it! A way too big pull request that includes a lot of refactoring (also in #25, which is now closed), and adds the ability to test autocomplete.

It includes not just a new output format for autocomplete, but some additional interesting autocomplete related statistics.

Here's the latest screenshot of the acceptance test output
screenshot from 2015-12-10 16 04 49

Fixes #23

The callback function doesn't have to be use for an output generator as
it was previously named.
This helps reinforce that they are related
exec_test_case.js has a lot of responsiblities now handled by smaller
more focused modules:

validate_test_suites.js: perform validation on test suites. Some errors
are recoverable, some are not

gather_test_suites.js: find all test suites, filter out tests that
shouldn't be run based on test type command line parameter

gather_test_urls.js: collect all the URLs from all the test cases that should be fetched

request_urls.js: perform all the fetching of URLs

eval_tests.js: run all the scoring code on each of our tests based on
the responses previously fetched

analyze_results.js: perform any final analysis required on the tests
results. currently it simply tallys up the
pass/fail/regression/improvement count

test_suite_helpers.js: miscellaneous helper code used in a few places
The return code is used as the return code for the entire process.
Previously each output generator was responsible for calling
process.exit which was easy to forget about.
The functionality that used to be in these files is now separated more
cleanly into many other files.
The `request_urls` module uses the
[HTTP.Agent](https://nodejs.org/api/http.html#http_class_http_agent)
class to limit the maximum number of open HTTP sockets (by default with
no agent configured, no artificial limit on the number of sockets is
set).

This means that instead of attempting to space out the actual calling of
request(), all the request() calls can be made at once, and then they
will only actually be performed a few at a time. In my testing this is
able to completely eliminate the possibility of overloading our server
with too many requests at once, while allowing for much faster test
suite execution.

As an added (small) bonus, HTTP keepalives are now set so the overhead
of initializing a connection for each request is removed, making things
even faster.

Finally, when results are cached in Fastly, the test suite can execute
extremely fast: I've seen over 400 request/second handled just fine.

Oh, and it's a lot less code :)
These are somewhat confusing because, for example, the autocomplete
tests can show that a completely correct result was first, but the test
still failed (because there was another expected result that wasn't
found).
This is much more friendly to dev.
There seems to an [issue](nodejs/node#2148)
with some versions of Node that cause one of stderr and stdout to be
buffered, while the other is not. This jumbles output if both are used.
It now has to be able to print the circular test case structure, and URL
info has slightly changed.
The test evaluation code can handle 500 responses, we just need to store
them.
These basically mean autocomplete was not helpful over search.
Production and dev have different timeouts
This is slower when testing against fastly, but multiple sockets can
easily overwhelm prodbuild or dev.
Otherwise, when some requests are currently being retried, the script
can exit early before printing results (but usually after waiting
through almost all of the fetching).
This reverts commit a21eb16.

Because of the timeout functionality of Elasticsearch, even using only
one socket can overwhelm a server when sending off requests as fast as
possible, if timeouts start coming back, requests need to be spaced out
and ExponentialBackoff is really good at that.
0 is now acceptable for minimum delay since all requests are queued
through a single socket. However, in the case of retries it's desireable
to slow down more severely to allow the Elasticsearch cluster to finish
processing any timed-out requests, so the exponent is increased. Finally
the maximum timeout is doubled to 20 seconds since an overloaded
Elasticsearch server tends to thrash (our 4 core prodbuild server will
sometimes have a load of 20+)
setTimeout and setInterval can't handle a 0ms delay, and
ExponentialBackoff defaults to 50ms when passed 0ms
orangejulius added a commit that referenced this pull request Jan 6, 2016
@orangejulius orangejulius merged commit bcd59f7 into master Jan 6, 2016
@orangejulius orangejulius deleted the autocomplete-tester branch March 23, 2016 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluate autocomplete by testing each keystroke of every test
1 participant