Reduce the size (and cost) of the host page

We strip any unnecessary whitespace from the header/footer and the
host page HTML, compacting it to a smaller size even before we pass
it off for gzip compression.  This reduces the size of final the
document we have to compress and send to the browser.

For anonymous users we now use a compressed anonymous copy of the
host page, so we only have to dump the byte array to the network
socket.  This slightly improves response time for the initial page
returned to the browser.

For identified users we put the host page together from two different
byte arrays, inserting into the middle the user's account data.
This is then compressed if the browser wants gzip compression.

Change-Id: I82665d9938a998ccc8b5cb2f792c8798974dcf85
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-12-29 13:42:38 -08:00
parent 67288bf63e
commit 4169a42fe9
5 changed files with 94 additions and 49 deletions

View File

@@ -223,8 +223,8 @@ public class Gerrit implements EntryPoint {
hpd.load(new GerritCallback<HostPageData>() {
public void onSuccess(final HostPageData result) {
myConfig = result.config;
if (result.userAccount != null) {
myAccount = result.userAccount;
if (result.account != null) {
myAccount = result.account;
applyUserPreferences();
}
onModuleLoad2(gStarting);

View File

@@ -23,6 +23,6 @@ import com.google.gwtjsonrpc.client.RpcImpl.Version;
@RpcImpl(version = Version.V2_0)
interface HostPageDataService extends RemoteJsonService {
@HostPageCache(name = "gerrit_hostpagedata_obj", once = true)
@HostPageCache(name = "gerrit_hostpagedata", once = true)
void load(AsyncCallback<HostPageData> callback);
}