Megatest

Check-in [78c69ec26e]
Login
Overview
Comment:Use busy more aggressively and turn off loaded in tcp-transport.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80
Files: files | file ages | folders
SHA1: 78c69ec26e9fe7c95e369b882fe7c301ce8bdb52
User & Date: matt on 2023-05-21 07:20:57
Other Links: branch diff | manifest | tags
Context
2023-05-21
07:44
Added timed ping but not used yet for throttling. check-in: 99d5a8b353 user: matt tags: v1.80
07:20
Use busy more aggressively and turn off loaded in tcp-transport. check-in: 78c69ec26e user: matt tags: v1.80
2023-05-20
22:03
If busy respond to ping as per normal. check-in: 1b2c38a5ef user: matt tags: v1.80
Changes

Modified api.scm from [ee972c1fef] to [cdbd53a18d].

250
251
252
253
254
255
256
257
258


259
260
261
262
263
264
265
266
267


268

269
270
271
272
273
274
275
250
251
252
253
254
255
256


257
258
259
260
261
262
263
264
265
266
267
268
269

270
271
272
273
274
275
276
277







-
-
+
+









+
+
-
+







			    ((ping) #t) ;; we are fine
			    (else
			     (if (not ok)(debug:print 0 *default-log-port* "ERROR: "cmd", run-id "run-id", not correct for dbfname "(dbr:dbstruct-dbfname dbstruct)))
			     (assert ok "FATAL: database file and run-id not aligned.")))))
		(ttdat   *server-info*)
		(server-state (tt-state ttdat))
		(status  (cond
			  ((> newcount 10) 'busy)
			  ((> newcount 5) 'loaded) ;; this gets transmitted to the client which calls tt:backoff-incr to slow stuff down.
			  ((> newcount 5) 'busy)
			  ;; ((> newcount 5) 'loaded) ;; this gets transmitted to the client which calls tt:backoff-incr to slow stuff down.
			  (else 'ok)))
		(errmsg  (case status
			   ((busy)   (conc "Server overloaded, "newcount" threads in flight"))
			   ((loaded) (conc "Server loaded, "newcount" threads in flight"))
			   (else     #f)))
		(result  (case status
			   ((busy)
			    (if (eq? cmd 'ping)
				(normal-proc cmd run-id params)
				;; newcount must be greater than 5 for busy
				(- newcount 4) ;; was 15
				15)) ;; (- newcount 29)) ;; call back in as many seconds
				)) ;; (- newcount 29)) ;; call back in as many seconds
			   ((loaded)
;; 			    (if (eq? (rmt:transport-mode) 'tcp)
;; 				(thread-sleep! 0.5))
			    (normal-proc cmd run-id params))
			   (else
			    (normal-proc cmd run-id params))))
		(meta   (case cmd

Modified tcp-transportmod.scm from [1f7b58bd4c] to [07073f2ea3].

231
232
233
234
235
236
237
238
239


240
241
242
243
244
245
246
231
232
233
234
235
236
237


238
239
240
241
242
243
244
245
246







-
-
+
+







		   (if (and (number? delay-wait)
			    (> delay-wait 0))
		       (begin
			 (debug:print 0 *default-log-port* "Server is loaded, delaying "delay-wait" seconds")
			 (thread-sleep! delay-wait)))))
	     (case status
	       ((busy) ;; result will be how long the server wants you to delay
		(debug:print 0 *default-log-port* "WARNING: server for "dbfname" is overloaded, will try again in "result" seconds.")
		(thread-sleep! (if (number? result) result 2))
		(debug:print 0 *default-log-port* "WARNING: server for "dbfname" is busy, will try again in "result" seconds.")
		(thread-sleep! (if (number? result) result 1))
		(tt:handler  ttdat cmd run-id params (+ attemptnum 1) area-dat areapath readonly-mode dbfname testsuite mtexe))
	       ((loaded)
		(debug:print 0 *default-log-port* "WARNING: server for "dbfname" is loaded, slowing queries.")
		(tt:backoff-incr (tt-conn-host conn)(tt-conn-port conn))
		result) ;; (tt:handler  ttdat cmd run-id params (+ attemptnum 1) area-dat areapath readonly-mode dbfname testsuite mtexe))
	       (else
		result)))