nickva commented on code in PR #5602:
URL: https://github.com/apache/couchdb/pull/5602#discussion_r2317578906


##########
src/docs/src/csrt/index.rst:
##########
@@ -0,0 +1,541 @@
+.. Licensed under the Apache License, Version 2.0 (the "License"); you may not
+.. use this file except in compliance with the License. You may obtain a copy 
of
+.. the License at
+..
+..   http://www.apache.org/licenses/LICENSE-2.0
+..
+.. Unless required by applicable law or agreed to in writing, software
+.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+.. License for the specific language governing permissions and limitations 
under
+.. the License.
+
+.. _csrt:
+
+===================================
+Couch Stats Resource Tracker (CSRT)
+===================================
+
+The `couch_srt` app introduces the Couch Stats Resource Tracker, aka CSRT for
+short. CSRT is a real time stats tracking system that tracks the quantity of
+resources induced at the process level in a live queryable manner, while also
+generating process lifetime reports containing statistics on the total resource
+load of a request, as a function of CouchDB operations like dbs/docs opened,
+view and changes rows read, changes returned vs processed, Javascript filter
+usage, request duration, and more. This system is a paradigm shift in CouchDB
+visibility and introspection, allowing for expressive real time querying
+capabilities to introspect, understand, and aggregate CouchDB internal resource
+usage, as well as powerful filtering facilities for conditionally generating
+reports on "heavy usage" requests or "long/slow" requests. CSRT also extends
+`recon:proc_window` with `couch_srt:proc_window` allowing for the same style of
+battle hardened introspection with Recon's excellent `proc_window`, but with
+the sample window over any of the CSRT tracked CouchDB stats!
+
+CSRT does this by piggy-backing off of the existing metrics tracked by way of
+`couch_stats:increment_counter` at the time when the local process induces
+those metrics inc calls, and then CSRT updates an ets entry containing the
+context information for the local process, such that global aggregate queries
+can be performed against the ets table as well as the generation of the process
+resource usage reports at the conclusions of the process's lifecycle.The 
ability
+to do aggregate querying in realtime in addition to the process lifecycle
+reports for post facto analysis over time, is a cornerstone of CSRT that is the
+result of a series of iterations until a robust and scalable approach was 
built.
+
+The real time querying is achieved by way of a global ets table with
+`read_concurrency`, `write_concurrency`, and `decentralized_counters` enabled.
+Great care was taken to ensure that _zero_ concurrent writes to the same key
+occur in this model, and this entire system is predicated on the fact that
+incremental updates to `ets:update_counters` provides *really* fast and
+efficient updates in an atomic and isolated fashion when coupled with
+decentralized counters and write concurrency. Each process that calls
+`couch_stats:increment_counter` tracks their local context in CSRT as well,
+with zero concurrent writes from any other processes. Outside of the context
+setup and teardown logic, _only_ operations to `ets:update_counter` are
+performed, one per process invocation of `couch_stats:increment_counter`, and
+one for coordinators to update worker deltas in a single batch, resulting in a
+1:1 ratio of ets calls to real time stats updates for the primary workloads.
+
+The primary achievement of CSRT is the core framework itself for concurrent
+process local stats tracking and real time RPC delta accumulation in a scalable
+manner that allows for real time aggregate querying and process lifecycle
+reports. This took several versions to find a scalable and robust approach that
+induced minimal impact on maximum system throughput. Now that the framework is
+in place, it can be extended to track any further desired process local uses of
+`couch_stats:increment_counter`. That said, the currently selected set of stats
+to track was heavily influenced by the challenges in retroactively
+understanding the quantity of resources induced by a query like
+`/db/_changes?since=$SEQ`, or similarly, `/db/_find`.
+
+CSRT started as an extension of the Mango execution stats logic to `_changes`
+feeds to get proper visibility into quantity of docs read and filtered per
+changes request, but then the focus inverted with the realization that we
+should instead use the existing stats tracking mechanisms that have already
+been deemed critical information to track, which then also allows for the real
+time tracking and aggregate query capabilities. The Mango execution stats can
+be ported into CSRT itself and just become one subset of the stats tracked as a
+whole, and similarly, any additional desired stats tracking can be easily added
+and will be picked up in the RPC deltas and process lifetime reports.
+
+.. seealso::
+
+    :doc:`/config/csrt`
+
+CSRT Overview
+-------------
+
+    When an incoming HTTP request is is handled by the CouchDB `chttpd` worker

Review Comment:
   `is is` -> `is`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to