Testing with remote server cache is unusably slow
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Feb 2016 23:55:58 +0000 (23:55 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Feb 2016 23:55:58 +0000 (23:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153928

Reviewed by Chris Dumez.

Don't use the single process mode of httpd as it's way too slow even for testing.
Also we'll hit a null pointer crash (http://svn.apache.org/viewvc?view=revision&revision=1711479)

Since httpd exits immediately when launched in multi-process mode, remote-cache-server.py (renamed from
run-with-remote-server.py) now has "start" and "stop" commands to start/stop the Apache. Also added
"reset" command to reset the cache for convenience.

* Install.md: Updated the instruction.
* config.json: Fixed a typo: httpdErro*r*Log.
* tools/remote-cache-server.py: Copied from Websites/perf.webkit.org/tools/run-with-remote-server.py.
Now takes one of the following commands: "start", "stop", and "reset".
(main):
(start_httpd): Extracted from main.
(stop_httpd): Added.
* tools/remote-server-relay.conf: Removed redundant (duplicate) LoadModule's.
* tools/run-with-remote-server.py: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@196195 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/Install.md
Websites/perf.webkit.org/config.json
Websites/perf.webkit.org/tools/remote-cache-server.py [new file with mode: 0755]
Websites/perf.webkit.org/tools/remote-server-relay.conf
Websites/perf.webkit.org/tools/run-with-remote-server.py [deleted file]

index 2d1ab7d..6c9e40c 100644 (file)
@@ -1,3 +1,27 @@
+2016-02-05  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Testing with remote server cache is unusably slow
+        https://bugs.webkit.org/show_bug.cgi?id=153928
+
+        Reviewed by Chris Dumez.
+
+        Don't use the single process mode of httpd as it's way too slow even for testing.
+        Also we'll hit a null pointer crash (http://svn.apache.org/viewvc?view=revision&revision=1711479)
+
+        Since httpd exits immediately when launched in multi-process mode, remote-cache-server.py (renamed from
+        run-with-remote-server.py) now has "start" and "stop" commands to start/stop the Apache. Also added
+        "reset" command to reset the cache for convenience.
+
+        * Install.md: Updated the instruction.
+        * config.json: Fixed a typo: httpdErro*r*Log.
+        * tools/remote-cache-server.py: Copied from Websites/perf.webkit.org/tools/run-with-remote-server.py.
+        Now takes one of the following commands: "start", "stop", and "reset".
+        (main):
+        (start_httpd): Extracted from main.
+        (stop_httpd): Added.
+        * tools/remote-server-relay.conf: Removed redundant (duplicate) LoadModule's.
+        * tools/run-with-remote-server.py: Removed.
+
 2016-02-04  Ryosuke Niwa  <rniwa@webkit.org>
 
         Perf dashboard should have a script to setup database
index 56d7ce7..908439e 100644 (file)
@@ -28,13 +28,10 @@ Remove "basicAuth" entry for production servers that doesn't require a basic aut
 }
 ```
 
-Then run `tools/run-with-remote-server.py`. This launches a httpd server on port 8080.
-
-The initial few page loads after starting the script could take as much as a few minutes depending on your production sever's configurations
-since Apache needs to start a pool of processes. Reloading the dashboards few times should bring the load time under control.
+Then run `tools/remote-cache-server.py start`. This launches a httpd server on port 8080.
 
 The script caches remote server's responses under `public/data/remote-cache` and never revalidates them (to allow offline work).
-If you needed the latest content, delete caches stored in this directory by running `rm -rf public/data/remote-cache`.
+If you needed the latest content, delete caches stored in this directory by running `tools/remote-cache-server.py reset`.
 
 
 # Configuring Apache
index 913dd21..cabc915 100644 (file)
@@ -19,7 +19,7 @@
     "remoteServer": {
         "httpdConfig": "tools/remote-server-relay.conf",
         "httpdPID": "tools/remote-server-relay.pid",
-        "httpdErroLog": "tools/remote-server-relay.log",
+        "httpdErrorLog": "tools/remote-server-relay.log",
         "url": "http://perf.webkit.org",
         "basicAuth": {
             "username": "username",
diff --git a/Websites/perf.webkit.org/tools/remote-cache-server.py b/Websites/perf.webkit.org/tools/remote-cache-server.py
new file mode 100755 (executable)
index 0000000..79cfa3c
--- /dev/null
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+
+import json
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+
+
+def main():
+    if len(sys.argv) <= 1:
+        sys.exit('Specify the command: start, stop, reset')
+
+    command = sys.argv[1]
+
+    with open(abspath_from_root('config.json')) as config_file:
+        config = json.load(config_file)
+
+    cache_dir = abspath_from_root(config['cacheDirectory'])
+    if command == 'start':
+        if not os.path.isdir(cache_dir):
+            os.makedirs(cache_dir)
+        os.chmod(cache_dir, 0755)
+
+        start_httpd(config['remoteServer'])
+    elif command == 'stop':
+        stop_httpd(config['remoteServer'])
+    elif command == 'reset':
+        shutil.rmtree(cache_dir)
+    else:
+        sys.exit('Unknown command: ' + command)
+
+
+def start_httpd(remote_server_config):
+    httpd_config_file = abspath_from_root(remote_server_config['httpdConfig'])
+    httpd_pid_file = abspath_from_root(remote_server_config['httpdPID'])
+    httpd_error_log_file = abspath_from_root(remote_server_config['httpdErrorLog'])
+    httpd_mutex_dir = abspath_from_root(remote_server_config['httpdMutexDir'])
+
+    if not os.path.isdir(httpd_mutex_dir):
+        os.makedirs(httpd_mutex_dir)
+    os.chmod(httpd_mutex_dir, 0755)
+
+    doc_root = abspath_from_root('public')
+
+    # don't use -X since http://svn.apache.org/viewvc?view=revision&revision=1711479
+    subprocess.call(['httpd',
+        '-f', httpd_config_file,
+        '-c', 'PidFile ' + httpd_pid_file,
+        '-c', 'Mutex file:' + httpd_mutex_dir,
+        '-c', 'DocumentRoot ' + doc_root,
+        '-c', 'ErrorLog ' + httpd_error_log_file])
+
+
+def stop_httpd(remote_server_config):
+    httpd_pid_file = abspath_from_root(remote_server_config['httpdPID'])
+    if not os.path.isfile(httpd_pid_file):
+        sys.exit("PID file doesn't exist at %s" % httpd_pid_file)
+
+    with open(httpd_pid_file) as pid_file:
+        pid = pid_file.read().strip()
+        print "Stopping", pid
+        subprocess.call(['kill', '-TERM', pid])
+
+
+def abspath_from_root(relpath):
+    return os.path.abspath(os.path.join(os.path.dirname(__file__), '../', relpath))
+
+
+if __name__ == "__main__":
+    main()
index 1e98c4a..0cf569a 100644 (file)
@@ -16,9 +16,7 @@ LoadModule negotiation_module libexec/apache2/mod_negotiation.so
 LoadModule dir_module libexec/apache2/mod_dir.so
 LoadModule alias_module libexec/apache2/mod_alias.so
 LoadModule rewrite_module libexec/apache2/mod_rewrite.so
-LoadModule mime_module libexec/apache2/mod_mime.so
 LoadModule php5_module libexec/apache2/libphp5.so
-LoadModule negotiation_module libexec/apache2/mod_negotiation.so
 
 <Directory />
     Options Indexes FollowSymLinks MultiViews
diff --git a/Websites/perf.webkit.org/tools/run-with-remote-server.py b/Websites/perf.webkit.org/tools/run-with-remote-server.py
deleted file mode 100755 (executable)
index 5421d22..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/python
-
-import json
-import os
-import subprocess
-import tempfile
-
-
-def main():
-    with open(abspath_from_root('config.json')) as config_file:
-        config = json.load(config_file)
-        cache_dir = abspath_from_root(config['cacheDirectory'])
-        httpd_config_file = abspath_from_root(config['remoteServer']['httpdConfig'])
-        httpd_pid_file = abspath_from_root(config['remoteServer']['httpdPID'])
-        httpd_error_log_file = abspath_from_root(config['remoteServer']['httpdErroLog'])
-        doc_root = abspath_from_root('public')
-
-        if not os.path.isdir(cache_dir):
-            os.makedirs(cache_dir)
-        os.chmod(cache_dir, 0755)
-
-        httpd_mutax_dir = tempfile.mkdtemp()
-        try:
-            subprocess.call(['httpd',
-                '-f', httpd_config_file,
-                '-c', 'PidFile ' + httpd_pid_file,
-                '-c', 'Mutex file:' + httpd_mutax_dir,
-                '-c', 'DocumentRoot ' + doc_root,
-                '-c', 'ErrorLog ' + httpd_error_log_file,
-                '-X'])
-        finally:
-            os.rmdir(httpd_mutax_dir)
-
-
-def abspath_from_root(relpath):
-    return os.path.abspath(os.path.join(os.path.dirname(__file__), '../', relpath))
-
-
-if __name__ == "__main__":
-    main()