subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1667120 - /subversion/trunk/subversion/mod_dav_svn/reports/log.c
Date Mon, 16 Mar 2015 20:19:39 GMT
Author: rhuijben
Date: Mon Mar 16 20:19:38 2015
New Revision: 1667120

URL: http://svn.apache.org/r1667120
Log:
Following up on r1666965, reduce the maximum number of extra flushes to
just four and update most comments, to explain the brigade behavior it
uses.

This keeps the algorithm very simple, while it should resolve most of the
compaints on adding too many flushes to the existing code.

* subversion/mod_dav_svn/reports/log.c
  (log_receiver): Make next flush interval 4 times bigger and stop
    earlier. Don't check if we just flushed, as we still want to make
    output filters flush as well.
  (dav_svn__log_report): Update initial value.

Modified:
    subversion/trunk/subversion/mod_dav_svn/reports/log.c

Modified: subversion/trunk/subversion/mod_dav_svn/reports/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/log.c?rev=1667120&r1=1667119&r2=1667120&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/log.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/log.c Mon Mar 16 20:19:38 2015
@@ -286,31 +286,39 @@ log_receiver(void *baton,
   SVN_ERR(dav_svn__brigade_puts(lrb->bb, lrb->output,
                                 "</S:log-item>" DEBUG_CR));
 
-  /* In general APR will flush the bucket every 8 KByte, but log items
-     may not be generated that fast, especially in combination with authz
-     and busy servers. This algorithm makes sure the client gets the first
-     two results very fast (but less efficient), while it gradually removes
-     its performance hit and falls back to the APR standard buffer handling,
-     which streamlines the http processing */
+  /* In general APR will flush the brigade every 8000 bytes through the filter
+     stack, but log items may not be generated that fast, especially in
+     combination with authz and busy servers. We now explictly flush after
+     log-item 4, 16, 64 and 256 to produce a few results fast.
+
+     This introduces 4 full flushes of our brigade and the installed output
+     filters at growing intervals and then falls back to the standard
+     buffering of 8000 bytes + whatever buffers are added in output filters. */
   lrb->result_count++;
   if (lrb->result_count == lrb->next_forced_flush)
     {
-      apr_off_t len = 0;
-      (void)apr_brigade_length(lrb->bb, FALSE, &len);
+      apr_status_t apr_err;
 
-      if (len != 0)
-        {
-          apr_status_t apr_err = ap_fflush(lrb->output, lrb->bb);
-          if (apr_err)
-            return svn_error_create(apr_err, NULL, NULL);
-
-          if (lrb->output->c->aborted)
-            return svn_error_create(SVN_ERR_APMOD_CONNECTION_ABORTED,
-                                    NULL, NULL);
-        }
+      /* This flush is similar to that in dav_svn__final_flush_or_error().
+
+         Compared to using ap_filter_flush(), which we use in other place
+         this adds a flush frame before flushing the brigade, to make output
+         filters perform a flush as well */
+
+      /* No brigade empty check. We want output filters to flush anyway */
+      apr_err = ap_fflush(lrb->output, lrb->bb);
+      if (apr_err)
+        return svn_error_create(apr_err, NULL, NULL);
+
+      /* Check for an aborted connection, just like our brigade write
+         helper functions, since the brigade functions don't appear to
+         be return useful errors when the connection is dropped. */
+      if (lrb->output->c->aborted)
+        return svn_error_create(SVN_ERR_APMOD_CONNECTION_ABORTED,
+                                NULL, NULL);
 
-      if (lrb->result_count < 2048)
-        lrb->next_forced_flush = lrb->next_forced_flush * 2;
+      if (lrb->result_count < 256)
+        lrb->next_forced_flush = lrb->next_forced_flush * 4;
     }
 
   return SVN_NO_ERROR;
@@ -459,7 +467,7 @@ dav_svn__log_report(const dav_resource *
   /* lrb.requested_custom_revprops set above */
 
   lrb.result_count = 0;
-  lrb.next_forced_flush = 1;
+  lrb.next_forced_flush = 4;
 
   /* Our svn_log_entry_receiver_t sends the <S:log-report> header in
      a lazy fashion.  Before writing the first log message, it assures



Mime
View raw message