1023 Commits

Author SHA1 Message Date
Noah Levitt
dc00f5de32 reimplement max_claimed_sites
Other approach was too slow and caused db contention.
New approach avoids (slow) rethinkdb join by max_claimed_sites job
parameter to each of the job's sites. Uses rethinkdb fold() to count
claimed sites and enforce max_claimed_sites within a single query.
2018-03-15 12:57:49 -07:00
Noah Levitt
55701ae373 bump version number after merge 2018-03-08 16:49:28 -08:00
jkafader
7d61673d3e
Merge pull request #97 from nlevitt/max-claimed-sites
Max claimed sites
2018-03-08 16:48:31 -08:00
Noah Levitt
4daac3dfc5 fix timely time limit enforcement
by including current brozzling session duration in time accounting
2018-03-05 17:05:41 -08:00
Noah Levitt
318ae13bcb honor stop request before choosing proxy
makes test_warcprox_outage_resiliency pass again
2018-03-05 16:08:24 -08:00
Noah Levitt
a914fb8461
Merge pull request #99 from vbanos/chromium-single-process
Use single process model for chromium-browser
2018-03-05 12:06:20 -08:00
Vangelis Banos
171ce8d854 Use single process model for chromium-browser
By default chromium creates multiple renderer processes (each running
multiple threads) for each instance of a site the user visits. What we
see from `ps auxcf` output is the following:
```
\_ chromium-browse
  \_ chromium-browse
  |   \_ chromium-browse
  |       \_ chromium-browse
  |       \_ chromium-browse
  |       \_ chromium-browse
```

Using the `--single-process` option, we run all renderers in the same
process, saving the overhead of running multiple processes. `ps auxcf`
output is the following:

```
\_ chromium-browse
  \_ chromium-browse
    \_ chromium-browse
```

Performance is improved a bit and I guess that using this in large scale
Brozzler deployments will have even better performance effects.

The potential problem of `--single-process` is stability (if a renderer
crashes, the whole browser also crashes) but since we use very short-lived
instances of chromium, we don't worry about this.

Details on chromium process models:
https://www.chromium.org/developers/design-documents/process-models
2018-03-04 20:48:29 +00:00
Noah Levitt
2639d7b991 fix query to make tests pass? 2018-03-02 16:30:35 -08:00
Noah Levitt
f9834ca77d bump after merge 2018-03-02 11:51:50 -08:00
Noah Levitt
a0710b605c
Merge pull request #96 from vbanos/jinja2-auto-reload
Disable Jinja2 template auto_reload for higher performance
2018-03-02 11:51:11 -08:00
Noah Levitt
f26d711a89 new job setting max_claimed_sites
Puts a cap on the number of sites belonging to a given job that can be brozzled
simultaneously across the cluster. Addresses the problem of a job with many
seeds starving out other jobs. For AITFIVE-1578.
2018-03-01 17:17:54 -08:00
Noah Levitt
d7512fbeb6 move time limit enforcement
now it's next to stop request enforcement which makes more sense and
supports more timely action
2018-03-01 11:28:30 -08:00
Vangelis Banos
ce473897a3 Disable Jinja2 template auto_reload for higher performance
Every time we run a JS behavior, we load a Jinja2 template.
By default, Jinja2 has option `auto_reload=True`. This mean that
every time a template is requested the loader checks if the source file changed
and if yes, it will reload the template. For higher performance it’s possible
to disable that.

Also note that Jinja caches 400 templates by default.

Ref: http://jinja.pocoo.org/docs/2.10/api/

In Brozzler, we don't make changes to JS templates while the system is
running. So, there is no point in having auto_reload=True.
2018-02-25 20:24:25 +00:00
Noah Levitt
b438cdd33e
Merge pull request #94 from vbanos/json-compact
Send more compact JSON to browser
2018-02-21 09:53:16 -08:00
Vangelis Banos
646faa8ab0 Invalid syntax in WebsockReceiverThread._javascript_dialog_open
Fix `)` position
2018-02-21 07:34:36 +00:00
Noah Levitt
eda5133301
Merge pull request #95 from vbanos/configurable-wait-interval
Make Browser._wait_for sleep time a varible
2018-02-20 15:05:34 -08:00
Vangelis Banos
e2128b42f0 Make Browser._wait_for sleep time a varible
Useful to be able to tweak this value in other apps using `Browser`.
2018-02-18 23:08:51 +00:00
Vangelis Banos
d6c707d941 Send more compact JSON to browser
Use JSON separators without spaces to reduce json size.
Its already used elsewhere in Brozzler but not here.
2018-02-18 19:03:36 +00:00
Noah Levitt
0d605d0a88
Merge pull request #90 from vbanos/chrome-flags-performance
Add chromium CLI flags to improve capture performance
2018-02-15 10:54:34 -08:00
Vangelis Banos
970e2bd661 Remove google safebrowsing flags
Global Wayback policy is to archive everything, so its best to avoid
disabling these flags.
2018-02-15 13:35:24 +00:00
Noah Levitt
9e4737ee0a
try to get chromium 64? (#92)
chromium 64 for travis-ci
2018-02-14 13:43:53 -08:00
Noah Levitt
f8c41c5e8d bump up timeout waiting for websocket connection
We've been seeing some of this:

2018-02-14 20:16:44,011 17816 CRITICAL BrozzlingThread:36444 brozzler.worker.BrozzlerWorker.brozzle_site(worker.py:559) unexpected exception
Traceback (most recent call last):
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/worker.py", line 528, in brozzle_site
    enable_youtube_dl=not self._skip_youtube_dl)
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/worker.py", line 385, in brozzle_page
    on_request)
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/worker.py", line 447, in _browse_page
    cookie_db=site.get('cookie_db'))
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/browser.py", line 338, in start
    self._wait_for(lambda: self.websock_thread.is_open, timeout=10)
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/browser.py", line 311, in _wait_for
    elapsed, callback))
brozzler.browser.BrowsingTimeout: timed out after 11.1s waiting for: <function Browser.start.<locals>.<lambda> at 0x7fb2dc772bd8>

Mostly at startup. Now that brozzler claims sites in batches for
brozzling, we have situations where we start up a whole bunch of
browsers at the same time. That's probably why in some cases they are
slow to establish the websocket connection.
2018-02-14 12:29:51 -08:00
Noah Levitt
b38fbdcda6 try taking screenshot 3 times, proceed on failure
We've been seeing a lot of this:

2018-02-14 20:06:01,472 13286 CRITICAL BrozzlingThread:44789 brozzler.worker.BrozzlerWorker.brozzle_site(worker.py:559) unexpected exception
Traceback (most recent call last):
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/worker.py", line 528, in brozzle_site
    enable_youtube_dl=not self._skip_youtube_dl)
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/worker.py", line 385, in brozzle_page
    on_request)
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/worker.py", line 459, in _browse_page
    behavior_timeout=self._behavior_timeout)
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/browser.py", line 463, in browse_page
    jpeg_bytes = self.screenshot()
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/browser.py", line 565, in screenshot
    timeout=timeout)
  File "/opt/brozzler-ve3/lib/python3.5/site-packages/brozzler/browser.py", line 311, in _wait_for
    elapsed, callback))
brozzler.browser.BrowsingTimeout: timed out after 90.5s waiting for: <function Browser.screenshot.<locals>.<lambda> at 0x7f5ab0076a68>

Browser bug, maybe? To work around it, reduce timeout to 45 seconds, try
getting screenshot 3 times, and if it fails proceed anyway, don't queue
the page for recrawling.
2018-02-14 12:15:48 -08:00
Noah Levitt
0faeaab3ac fix attempt for deadlock-ish situation
see https://github.com/internetarchive/brozzler/issues/91
2018-02-13 17:09:28 -08:00
Noah Levitt
6086bfe4b4 fix unclosed file warnings when running python in debug mode 2018-02-13 17:07:40 -08:00
Noah Levitt
56e01b9078 give vagrant vm a name in virtualbox 2018-02-13 17:05:45 -08:00
Vangelis Banos
dffd9504af Add chromium CLI flags to improve capture performance
``--disable-background-timer-throttling`` and ``--disable-renderer-backgrounding``:
karma JS test runner uses these to improve chrome performance
https://github.com/karma-runner/karma-chrome-launcher/issues/123

``--disable-hang-monitor``: Suppresses hang monitor dialogs in renderer
processes. This may allow slow unload handlers on a page to prevent the
tab from closing, but the Task Manager can be used to terminate the
offending process in this case.

``--mute-audio``: obvious.

The following are part of google safe browsing features:
``--disable-client-side-phishing-detection``
``--safebrowsing-disable-auto-update``
``--safebrowsing-disable-download-protection``

Reference: https://peter.sh/experiments/chromium-command-line-switches/
2018-02-13 12:32:39 +00:00
Noah Levitt
e13b458bb9
Merge pull request #89 from internetarchive/ARI-5517
umbraBehavior for thejewishnews.com
2018-02-12 16:13:01 -08:00
Barbara Miller
88076595ba comment tweak 2018-02-12 10:22:41 -08:00
Barbara Miller
668e85be9e umbraBehavior for thejewishnews.com 2018-02-08 13:05:18 -08:00
Noah Levitt
057284c2a7
Merge pull request #88 from nlevitt/block-urls
Block google analytics URLs using new Network.setBlockedURLs API
2018-02-06 16:42:24 -08:00
Noah Levitt
791f77d8a6 add note to readme about browser version 2018-02-06 16:00:14 -08:00
Noah Levitt
506ab0ccc2 check browser version at startup 2018-02-06 15:56:50 -08:00
Vangelis Banos
3b800b583f Reinstate logging 2018-02-06 14:48:30 -08:00
Vangelis Banos
e48ad46a63 Fix typo and block legacy google-analytics.com/ga.js 2018-02-06 14:47:01 -08:00
Vangelis Banos
f54d62ea40 Use Network.setBlockedUrls instead of Debugger to block URLs 2018-02-06 14:47:01 -08:00
Noah Levitt
fc000ff515 bump dev version after PR merge 2018-02-06 12:14:53 -08:00
jkafader
07b961efaf
Merge pull request #85 from nlevitt/claim-batches
WIP: claim sites to brozzle in batches to reduce contention over sites table
2018-02-06 12:01:30 -08:00
Noah Levitt
9a0941f1fd Merge branch 'master' into claim-batches
* master:
  back to dev version number
  commit for beta release
  this should fix travis build?
  fix tests
  update brozzler-easy for current warcprox api
  simpleclicks for minutes PDF
2018-02-06 11:46:15 -08:00
Noah Levitt
d36d574e58
Merge pull request #87 from internetarchive/ARI-5294
capture citymedfordwi.civicweb.net minutes PDFs
2018-02-05 13:19:11 -08:00
Noah Levitt
95cbfa96e2 back to dev version number 2018-02-02 16:54:29 -08:00
Noah Levitt
2a0ad6d0de commit for beta release 1.1b12 2018-02-02 16:52:42 -08:00
Noah Levitt
9ba58de292 this should fix travis build? 2018-02-02 16:25:56 -08:00
Noah Levitt
8505720c41 fix tests 2018-02-02 15:11:26 -08:00
Noah Levitt
5331aca33f update brozzler-easy for current warcprox api 2018-02-02 14:28:46 -08:00
Noah Levitt
7962444f09 claim sites to brozzle in batches to reduce contention over sites table 2018-02-02 13:56:24 -08:00
jkafader
a125434563
Merge pull request #83 from nlevitt/fifteen-minutes
lengthen site session brozzling time to 15 minutes
2018-01-29 15:59:16 -08:00
Noah Levitt
64211475c0 lengthen site session brozzling time to 15 minutes
This should reduce contention over the "sites" table, which should help
keep more available browsers busy across the cluster.
2018-01-29 15:34:54 -08:00
Noah Levitt
4d37f88bcb
Merge pull request #75 from galgeek/pageInterstitialShown
log Page.interstitialShown
2018-01-26 16:18:22 -08:00
Noah Levitt
0e17205e17
Merge pull request #82 from vbanos/websock-tcp-nodely
Use TCP_NODELAY in websocket connection to improve performance
2018-01-26 12:14:44 -08:00