You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DOC-12312: streaming completed requests to local files (#273)
* Add Streaming Completed Requests
* Try to make tabs sync with only partial success
* Add system:completed_requests_history to sysinfo
* Add links to Admin REST API
* Update table formatting for sysinfo
* Add links to gzip and jq
Copy file name to clipboardExpand all lines: modules/n1ql/pages/n1ql-manage/monitoring-n1ql-query.adoc
+85-9Lines changed: 85 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ This information can be very useful to assess the current workload and performan
52
52
[#sys-vitals-get]
53
53
=== Get System Vitals
54
54
55
-
To view system vitals, use the Admin REST API or a {sqlpp} query.
55
+
To view system vitals, use the xref:n1ql:n1ql-rest-api/admin.adoc[Admin REST API] or a {sqlpp} query.
56
56
57
57
[tabs]
58
58
====
@@ -126,7 +126,7 @@ The `system:active_requests` catalog lists all currently executing active reques
126
126
[[sys-active-get]]
127
127
=== Get Active Requests
128
128
129
-
To view active requests, use the Admin REST API or a {sqlpp} query.
129
+
To view active requests, use the xref:n1ql:n1ql-rest-api/admin.adoc[Admin REST API] or a {sqlpp} query.
130
130
131
131
[tabs]
132
132
====
@@ -173,7 +173,7 @@ SELECT *, meta().plan FROM system:active_requests;
173
173
[[sys-active-delete]]
174
174
=== Terminate an Active Request
175
175
176
-
The DELETE command can be used to terminate an active request, for instance, a non-responding or a long-running query.
176
+
To terminate an active request, for instance, a non-responding or a long-running query, use the xref:n1ql:n1ql-rest-api/admin.adoc[Admin REST API] or a {sqlpp} query.
177
177
178
178
[tabs]
179
179
====
@@ -272,7 +272,7 @@ When there are multiple prepared statements with the same name in different quer
272
272
[[sys-prepared-get]]
273
273
=== Get Prepared Statements
274
274
275
-
To get a list of all known prepared statements, use the Admin REST API or a {sqlpp} query.
275
+
To get a list of all known prepared statements, use the xref:n1ql:n1ql-rest-api/admin.adoc[Admin REST API] or a {sqlpp} query.
276
276
277
277
[tabs]
278
278
====
@@ -346,7 +346,7 @@ SELECT *, meta().plan FROM system:prepareds;
346
346
[[sys-prepared-delete]]
347
347
=== Delete Prepared Statements
348
348
349
-
To delete a specific prepared statement, use the Admin REST API or a {sqlpp} query.
349
+
To delete a specific prepared statement, use the xref:n1ql:n1ql-rest-api/admin.adoc[Admin REST API] or a {sqlpp} query.
350
350
351
351
[tabs]
352
352
====
@@ -492,7 +492,7 @@ This information provides a general insight into the health and performance of t
492
492
[[sys-completed-get]]
493
493
=== Get Completed Requests
494
494
495
-
To get a list of all logged completed requests, use the Admin REST API or a {sqlpp} query.
495
+
To get a list of all logged completed requests, use the xref:n1ql:n1ql-rest-api/admin.adoc[Admin REST API] or a {sqlpp} query.
496
496
497
497
[tabs]
498
498
====
@@ -559,7 +559,7 @@ SELECT *, meta().plan FROM system:completed_requests;
559
559
[[sys-completed-delete]]
560
560
=== Purge the Completed Requests
561
561
562
-
To purge a specific completed request, use the Admin REST API or a {sqlpp} query.
562
+
To purge a specific completed request, use the xref:n1ql:n1ql-rest-api/admin.adoc[Admin REST API] or a {sqlpp} query.
563
563
564
564
[tabs]
565
565
====
@@ -690,9 +690,9 @@ For field names and meanings, see xref:n1ql-rest-admin:index.adoc#Requests[Reque
690
690
For query plan field names and meanings, see <<monitor-profile-details>>.
691
691
692
692
[[sys-completed-config]]
693
-
== Configure the Completed Requests
693
+
== Configure Completed Requests
694
694
695
-
You can configure the `system:completed_requests` keyspace by specifying parameters through the Admin API `/admin/settings` endpoint.
695
+
You can configure the `system:completed_requests` keyspace by specifying parameters through the xref:n1ql:n1ql-rest-api/admin.adoc[Admin REST API] `/admin/settings` endpoint.
696
696
697
697
You can specify the conditions for completed request logging using the `completed` field.
698
698
This field takes a JSON object containing the names and values of logging qualifiers.
In Couchbase Server 7.6.4 and later, you can stream completed requests to disk.
828
+
829
+
To enable completed request streaming, use the xref:n1ql:n1ql-rest-api/admin.adoc[Admin REST API] `/admin/settings` endpoint to specify the `completed_stream_size` property.
When set to `0` (the default), completed request streaming is disabled.
840
+
841
+
When set to any size greater than `0`, completed requests are streamed to archive files.
842
+
The value of this property determines the size of the data to retain, per node.
843
+
The configuration for completed requests determines which requests are saved.
844
+
845
+
NOTE: The additional processing required to save completed requests to disk may limit overall request throughput on a Query node, but typically only when every completed request is being recorded, and requests are very small or short-lived.
846
+
The speed of the file system on which the server logs directory resides naturally affects the potential impact too.
847
+
848
+
[#sys-history-files]
849
+
=== Archived Request Files
850
+
851
+
When streaming is enabled, completed requests are saved to GZIP archives with the prefix `local_request_log` in the Couchbase Server `logs` directory.
852
+
Each saved GZIP archive file contains multiple JSON entries, one for each for each recorded completed request.
853
+
854
+
Couchbase Server writes multiple archive files in parallel, so whilst the order of requests in a file is sequential, a single given file may not contain a contiguous sequence of requests.
855
+
856
+
When an archive file reaches or exceeds 100 MiB, it is finalized and saved to disk.
857
+
This is not a hard limit -- entries are not truncated to adhere to it.
858
+
Files may also be finalized with less content, if nothing has been written to them for an extended period.
859
+
Files that are actively being written are not available for reading, and they don't count towards the configured size limit until they're finalized.
860
+
861
+
Couchbase Server tries to manage and retain archive files such that the total disk space used by the files is within the specified limit for the node.
862
+
When the specified limit is reached, older files are removed as necessary to make space for newly finalized files.
863
+
When a file is removed, it isn't guaranteed that only the oldest requests are evicted, given that Couchbase Server writes to multiple archive files in parallel.
864
+
865
+
[#sys-history-view]
866
+
=== View Archived Requests
867
+
868
+
To view archived completed requests, use https://www.gnu.org/software/gzip[gzip] and https://jqlang.github.io/jq[jq] on the command line, or a {sqlpp} query.
869
+
870
+
[tabs,sync-group-id="REST API|{sqlpp}"]
871
+
====
872
+
Command Line::
873
+
+
874
+
--
875
+
To view all archived completed requests in `$FILE`:
876
+
877
+
[source,sh]
878
+
----
879
+
gzip -qdc $FILE | jq .
880
+
----
881
+
--
882
+
883
+
{sqlpp}::
884
+
+
885
+
--
886
+
To get a list of archived completed requests using {sqlpp}:
887
+
888
+
[source,sqlpp]
889
+
----
890
+
SELECT * FROM system:completed_requests_history;
891
+
----
892
+
--
893
+
====
894
+
895
+
The `system:completed_requests_history` keyspace is provided for {sqlpp} access to the archived files, but as they are external GZIP archives performance is restricted, particularly with large histories on clusters with multiple Query service nodes.
896
+
Directly reading the files may be more useful in some cases.
0 commit comments