[master] b175cc6 progress on dot graphs - add cache_fetch.dot for backend side

Nils Goroll nils.goroll at uplex.de
Tue Oct 7 15:09:31 CEST 2014


commit b175cc68326c0dc1eb69941992ffbe69c478c43e
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Oct 6 22:36:47 2014 +0200

    progress on dot graphs - add cache_fetch.dot for backend side

diff --git a/doc/graphviz/Makefile.am b/doc/graphviz/Makefile.am
index 8d2ca8f..51e2b4c 100644
--- a/doc/graphviz/Makefile.am
+++ b/doc/graphviz/Makefile.am
@@ -10,7 +10,8 @@ if HAVE_PS2PDF
 
 PDFS = \
 	cache_http1_fsm.pdf \
-	cache_req_fsm.pdf
+	cache_req_fsm.pdf \
+	cache_fetch.pdf
 
 pdf: $(PDFS)
 
diff --git a/doc/graphviz/cache_fetch.dot b/doc/graphviz/cache_fetch.dot
new file mode 100644
index 0000000..0a9fdf1
--- /dev/null
+++ b/doc/graphviz/cache_fetch.dot
@@ -0,0 +1,106 @@
+digraph cache_fetch {
+	margin="0.5"
+	center="1"
+	rotate=90
+
+	/*** cache_fetch.c ***/
+	subgraph cluster_backend {
+		style=filled
+		color=aliceblue
+		RETRY [shape=plaintext]
+		v_b_f_BGFETCH [label="BGFETCH",
+			       shape=box,
+			       style=filled,
+			       color=turquoise]
+		v_b_f_FETCH [label="FETCH",
+			       shape=box,
+			       style=filled,
+			       color=turquoise]
+		v_b_f_BGFETCH -> v_b_f [style=bold,color=green]
+		v_b_f_FETCH -> v_b_f [style=bold,color=blue]
+		v_b_f_FETCH -> v_b_f [style=bold,color=red]
+		RETRY -> v_b_f [color=purple]
+		/* vbf_stp_startfetch() */
+		v_b_f [
+			    shape=record
+			    label="
+			    {vbf_stp_startfetch:|
+				    {vcl_backend_fetch\{\}|bereq.*}|
+				    {abandon|
+					    <fetch>fetch}}"
+		]
+		v_b_f:fetch:s -> v_b_hdrs [style=bold]
+		v_b_hdrs [ label="send bereq,\nread beresp (headers)"]
+		v_b_hdrs -> v_b_r [style=bold]
+		v_b_hdrs -> v_b_e
+		v_b_r [
+			    shape=record
+			    label="
+			    {vbf_stp_startfetch:|
+				    {vcl_backend_response\{\}|{
+					    bereq.*|beresp.*}}|
+				    {{retry|{<max>max?|<retry>ok?}}|
+				    abandon|
+				    {deliver|{<fetch_304>304?|
+					    <fetch_body>body?}}}}"
+		]
+		v_b_r:retry -> v_b_r_retry [color=purple]
+		v_b_r:max -> v_b_e
+		v_b_r:fetch_304:s -> vbf_stp_condfetch
+		v_b_r:fetch_body:s -> vbf_stp_fetch
+
+		v_b_r_retry [label="RETRY",shape=plaintext]
+
+		vbf_stp_fetch [
+			       shape=record
+			       fontcolor=grey
+			       color=grey
+			       label="
+			       {vbf_stp_fetch:|
+				       setup VFPs|
+				       <fetch>fetch|
+				       {fetch_fail?|error?|<ok>ok?}}"
+				       ]
+		vbf_stp_fetch:ok:s -> FETCH_DONE
+
+		vbf_stp_condfetch [
+			       shape=record
+			       fontcolor=grey
+			       color=grey
+			       label="
+			       {vbf_stp_condfetch:|
+				       copy obj attr|
+				       steal body|
+				       {fetch_fail?|<ok>ok?}}"
+
+		]
+		vbf_stp_condfetch:ok:s -> FETCH_DONE
+
+		/* vbf_stp_error */
+		v_b_e [
+			    shape=record
+			    label="
+			    {vbf_stp_error:|
+				    {vcl_backend_error\{\}|{
+					    bereq.*|beresp.*}}|
+				    {{retry|{<max>max?|<retry>ok?}}|
+				    <deliver>deliver}}}"
+				    ]
+		// v_b_e:deliver aka "backend synth" - goes into cache
+		v_b_e:deliver -> FETCH_DONE [label="\"backend synth\""]
+		v_b_e:retry -> v_b_e_retry [color=purple]
+		v_b_e_retry [label="RETRY",shape=plaintext]
+		v_b_e:max:s -> FETCH_FAIL
+
+		v_b_e_retry [label="RETRY",shape=plaintext]
+
+		FETCH_DONE [label="FETCH_DONE",
+			    shape=box,style=filled,color=turquoise]
+
+		abandon [shape=plaintext]
+		abandon -> FETCH_FAIL
+		// F_STP_FAIL
+		FETCH_FAIL [label="FETCH_FAIL",
+			    shape=box,style=filled,color=turquoise]
+	}
+}
\ No newline at end of file
diff --git a/doc/graphviz/cache_req_fsm.dot b/doc/graphviz/cache_req_fsm.dot
index 6b526c8..5cea42c 100644
--- a/doc/graphviz/cache_req_fsm.dot
+++ b/doc/graphviz/cache_req_fsm.dot
@@ -1,110 +1,246 @@
- digraph vcl_center {
-	margin="0.5"
+digraph cache_req_fsm {
+	margin="0.25"
+	ranksep="0.5"
 	center="1"
- acceptor [
-	shape=hexagon
-	label="Request received"
- ]
- ESI_REQ [ shape=hexagon ]
- ESI_REQ -> recv
- SYNTH [shape=plaintext]
- RESTART [shape=plaintext]
- acceptor -> recv [style=bold,color=green]
-	deliver [
-		shape=record
-		label="{cnt_deliver:|Filter obj.-\>resp.|{vcl_deliver\{\}|{req.|resp.}}|{restart?|<deliver>deliver?}}"
-	]
- deliver:deliver:s -> DONE [style=bold,color=green]
- deliver:deliver:s -> DONE [style=bold,color=red]
- deliver:deliver:s -> DONE [style=bold,color=blue]
- subgraph xcluster_synth {
-	synth [
-		shape=record
-		label="{cnt_synth:|{vcl_synth\{\}|resp.}|{<del>deliver?|<restart>restart?}}"
-	]
-	SYNTH -> synth
-	synth:del:s -> deliver [label=deliver]
- }
- subgraph xcluster_body {
-	fetch [
-		shape=record
-		label="{cnt_fetch:|wait for fetch|{<ok>OK|<err>Failed}}"
-	]
- }
- fetch:ok:s -> deliver [style=bold,color=red]
- fetch:ok:s -> deliver [style=bold,color=blue]
- fetch:err:s -> vcl_error
- subgraph xcluster_lookup {
-	lookup [
-		shape=record
-		label="{<top>cnt_lookup:|hash lookup|{<busy>busy?|<e>exp?|<eb>exp+busy?|<h>hit?|<miss>miss?|<hfp>hit-for-pass?}}"
-	]
-	lookup2 [
-		shape=record
-		label="{<top>cnt_lookup:|{vcl_hit\{\}|req.*, obj.*}|{<deliver>deliver?|synth?|restart?|<fetch>fetch?|<pass>pass?}}"
-	]
- }
- lookup:busy:w -> lookup:top:w [label="(waitinglist)"]
- lookup:miss:s -> miss [style=bold,color=blue]
- lookup:hfp:s -> pass [style=bold,color=red]
- lookup:e:s -> lookup2 [style=bold,color=green]
- lookup:eb:s -> lookup2 [style=bold,color=green]
- lookup:h:s -> lookup2 [style=bold,color=green]
- lookup2:pass:s -> pass [style=bold,color=red]
- lookup2:fetch:s -> miss [style=bold,color=blue]
- lookup2:deliver:s -> deliver:n [style=bold,color=green]
- subgraph xcluster_miss {
-	miss [
-		shape=record
-		label="{cnt_miss:|{vcl_miss\{\}|req.*}|{<fetch>fetch?|<synth>synth?|<rst>restart?|<pass>pass?}}"
-	]
- }
- miss:fetch:s -> fetch [label="fetch",style=bold,color=blue]
- miss:pass:s -> pass [label="pass",style=bold,color=red]
-
- subgraph xcluster_pass {
-	pass [
-		shape=record
-		label="{cnt_pass:|{vcl_pass\{\}|req.*}|{<fetch>fetch?|<synth>synth?|<rst>restart?}}"
-	]
- }
- pass:fetch:s -> fetch:n [style=bold, color=red]
- subgraph xcluster_pipe {
-	pipe [
-		shape=record
-		label="{cnt_pipe:|filter req.*-\>bereq.*|{vcl_pipe()|req.*, bereq\.*}|{<pipe>pipe?|<synth>synth?}}"
-	]
-	pipe_do [
-		shape=ellipse
-		label="send bereq.\npipe until close"
-	]
-	pipe:pipe -> pipe_do [label="pipe",style=bold,color=orange]
- }
- pipe_do -> DONE [style=bold,color=orange]
- subgraph xcluster_restart {
-	restart [
-		shape=record
-		label="{cnt_restart}"
+
+	//// XXX does this belong here? -- from cache_vcl.c
+	/*
+	vcl_load [label = "vcl.load",shape=plaintext]
+	vcl_load -> init
+	init [
+	      shape=record
+	      label="
+	      {VCL_Load:|
+		      {vcl_init}|
+		      {<ok>ok|<fail>fail}}"
 	]
- }
- RESTART -> restart [color=purple]
- restart -> recv [color=purple]
- restart -> err_restart
- err_restart [label="SYNTH",shape=plaintext]
- subgraph xcluster_recv {
-	recv [
-		shape=record
-		label="{cnt_recv:|{vcl_recv\{\}|req.*}|{vcl_hash\{\}|req.*}|{<lookup>lookup?|<pass>pass?|<pipe>pipe?|<synth>synth?|<purge>purge?}}"
+	init:ok -> ok
+	init:fail -> fail
+
+	vcl_discard [label = "vcl.discard",shape=plaintext]
+	vcl_discard -> fini
+	fini [
+	      shape=record
+	      label="
+	      {VCL_Nuke:|
+		      {vcl_fini}|
+		      {<ok>ok}}"
 	]
- }
- recv:pipe -> pipe [style=bold,color=orange]
- recv:pass -> pass [style=bold,color=red]
- recv:lookup:s -> lookup [style=bold,color=green]
- recv:purge:s -> purge [style=bold,color=purple]
- subgraph xcluster_purge {
-	purge [
-		shape=record
-		label="{cnt_purge:|{vcl_purge\{\}|req.*}|{<synth>synth?}}"
+	fini:ok -> ok
+	*/
+
+	acceptor [
+		  shape=hexagon
+		  label="Request received"
 	]
- }
- }
+	ESI_REQ [ shape=hexagon ]
+	RESTART [shape=plaintext]
+
+	ESI_REQ -> recv
+	SYNTH [shape=plaintext]
+	acceptor -> recv [style=bold]
+
+	subgraph xcluster_deliver {
+		/* cnt_deliver() */
+		deliver [
+			 shape=record
+			 label="
+			 {cnt_deliver:|
+				 Filter obj.-\>resp.|
+				 {vcl_deliver\{\}|
+				 {req.*|resp.*}}|
+				 {restart|<deliver>deliver|<synth>synth}}"
+		]
+
+		deliver:deliver:s -> V1D_Deliver [style=bold,color=green]
+		deliver:deliver:s -> V1D_Deliver [style=bold,color=red]
+		deliver:deliver:s -> V1D_Deliver [style=bold,color=blue]
+
+		stream [label="stream?\nbody",style=filled,color=turquoise]
+		stream -> V1D_Deliver [style=dotted]
+	}
+
+	V1D_Deliver -> DONE
+
+	/* cnt_synth() */
+	subgraph xcluster_synth {
+		synth [
+		       shape=record
+		       label="
+		       {cnt_synth:|
+			       {vcl_synth\{\}|{req.*|resp.*}}|
+			       {<del>deliver|<restart>restart}}"
+		]
+
+		SYNTH -> synth [color=purple]
+		synth:del:s -> V1D_Deliver_Synth [color=purple]
+
+		V1D_Deliver_Synth -> DONE
+	}
+
+	subgraph cluster_backend {
+		style=filled
+		color=aliceblue
+
+		"see backend graph" [shape=plaintext]
+
+		node [shape=box,
+		      style=filled,
+		      color=turquoise]
+
+		BGFETCH
+		FETCH
+		FETCH_DONE
+		FETCH_FAIL
+	}
+
+	lookup2:deliver:s -> BGFETCH [label="parallel\nif obj expired",
+				      color=green]
+	FETCH_FAIL -> synth [color=purple]
+
+	FETCH_DONE -> deliver [style=bold,color=red]
+	FETCH_DONE -> deliver [style=bold,color=blue]
+	FETCH -> FETCH_DONE [style=dotted]
+	FETCH -> FETCH_FAIL [style=dotted]
+	/* cnt_lookup() */
+	subgraph xcluster_lookup {
+		lookup [
+			shape=record
+			color=grey
+			fontcolor=grey
+			label="
+			{<top>cnt_lookup:|
+				hash lookup|
+				{<busy>busy?|
+					<h>hit?|
+					<miss>miss?|
+					<hfp>hit-for-pass?}}"
+		]
+		lookup2 [
+			 shape=record
+			 label="
+			 {<top>cnt_lookup:|
+				 {vcl_hit\{\}|{req.*|obj.*}}|
+				 {<deliver>deliver|
+					 <fetch>fetch|
+					 restart|
+					 synth|
+					 <pass>pass}}"
+		]
+	}
+	lookup:busy:w -> lookup:top:w [label="(waitinglist)",
+				       color=grey,
+				       fontcolor=grey]
+	lookup:miss:s -> miss [style=bold,color=blue]
+	lookup:hfp:s -> pass [style=bold,color=red]
+	lookup:h:s -> lookup2 [style=bold,color=green]
+
+	lookup2:deliver:s -> deliver:n [style=bold,color=green]
+	lookup2:fetch:s -> miss [style=bold,color=blue]
+	// XXX should not happen
+	// lookup2:fetch:s -> pass [style=bold,color=red,label="(no busy obj)"]
+	lookup2:pass:s -> pass [style=bold,color=red]
+
+	/* cnt_miss */
+	subgraph xcluster_miss {
+		miss [
+		      shape=record
+		      label="
+		      {cnt_miss:|
+			      {vcl_miss\{\}|req.*}|
+			      {<fetch>fetch|
+				      <synth>synth|
+				      <rst>restart|
+				      <pass>pass}}"
+		]
+	}
+	miss:fetch:s -> FETCH [style=bold,color=blue]
+	miss:pass:s -> pass [style=bold,color=red]
+
+	/* cnt_pass */
+	subgraph xcluster_pass {
+		pass [
+		      shape=record
+		      label="{cnt_pass:|
+			      {vcl_pass\{\}|req.*}|
+			      {<fetch>fetch|
+				      <synth>synth|
+				      <rst>restart}}"
+		]
+	}
+	pass:fetch:s -> FETCH [style=bold, color=red]
+
+	/* cnt_pipe */
+	subgraph xcluster_pipe {
+		pipe [
+		      shape=record
+		      label="
+		      {cnt_pipe:|
+			      filter req.*-\>bereq.*|
+			      {vcl_pipe\{\}|{req.*|bereq.*}}|
+			      {<pipe>pipe|
+				      <synth>synth}}"
+		]
+		pipe_do [
+			 shape=ellipse
+			 label="send bereq.\ncopy bytes until close"
+		]
+		pipe:pipe -> pipe_do [style=bold,color=orange]
+	}
+	pipe_do -> DONE [style=bold,color=orange]
+
+	/* cnt_restart */
+	subgraph xcluster_restart {
+		restart [
+			shape=record
+			color=grey
+			fontcolor=grey
+			label="
+			 {cnt_restart:|
+				 {<ok>ok?|
+					 <max>max_restarts?}}"
+		]
+	}
+	RESTART -> restart [color=purple]
+	restart:ok:s -> recv
+	restart:max:s -> err_restart [color=purple]
+	err_restart [label="SYNTH",shape=plaintext]
+
+	/* cnt_recv() */
+	subgraph xcluster_recv {
+		recv [
+		      shape=record
+		      label="
+		      {cnt_recv:|
+			      {vcl_recv\{\}|req.*}|
+			      {<hash>hash|
+				      <pass>pass|
+				      <pipe>pipe|
+				      <synth>synth|
+				      <purge>purge}}"
+				      ]
+		recv:hash -> hash [style=bold,color=green]
+		hash [
+		      shape=record
+		      label="
+		      {cnt_recv:|
+			      {vcl_hash\{\}|req.*}|
+			      {<lookup>lookup}}"]
+	}
+	recv:pipe -> pipe [style=bold,color=orange]
+	recv:pass -> pass [style=bold,color=red]
+	hash:lookup:s -> lookup [style=bold,color=green]
+	recv:purge:s -> purge [style=bold,color=purple]
+
+	/* cnt_purge */
+	subgraph xcluster_purge {
+		purge [
+		       shape=record
+		       label="
+		       {cnt_purge:|
+			       {vcl_purge\{\}|req.*}|
+			       {<synth>synth|
+				       <restart>restart}}"
+		]
+	}
+}
\ No newline at end of file



More information about the varnish-commit mailing list