mirror of https://github.com/grpc/grpc-go.git
				
				
				
			grpc: Improve documentation of read/write buffer size server and dial options (#5800)
Fixes https://github.com/grpc/grpc-go/issues/5798
This commit is contained in:
		
							parent
							
								
									09fc1a3498
								
							
						
					
					
						commit
						0fe49e823f
					
				|  | @ -116,8 +116,9 @@ func newFuncDialOption(f func(*dialOptions)) *funcDialOption { | |||
| // be twice the size to keep syscalls low. The default value for this buffer is
 | ||||
| // 32KB.
 | ||||
| //
 | ||||
| // Zero will disable the write buffer such that each write will be on underlying
 | ||||
| // connection. Note: A Send call may not directly translate to a write.
 | ||||
| // Zero or negative values will disable the write buffer such that each write
 | ||||
| // will be on underlying connection. Note: A Send call may not directly
 | ||||
| // translate to a write.
 | ||||
| func WithWriteBufferSize(s int) DialOption { | ||||
| 	return newFuncDialOption(func(o *dialOptions) { | ||||
| 		o.copts.WriteBufferSize = s | ||||
|  | @ -127,8 +128,9 @@ func WithWriteBufferSize(s int) DialOption { | |||
| // WithReadBufferSize lets you set the size of read buffer, this determines how
 | ||||
| // much data can be read at most for each read syscall.
 | ||||
| //
 | ||||
| // The default value for this buffer is 32KB. Zero will disable read buffer for
 | ||||
| // a connection so data framer can access the underlying conn directly.
 | ||||
| // The default value for this buffer is 32KB. Zero or negative values will
 | ||||
| // disable read buffer for a connection so data framer can access the
 | ||||
| // underlying conn directly.
 | ||||
| func WithReadBufferSize(s int) DialOption { | ||||
| 	return newFuncDialOption(func(o *dialOptions) { | ||||
| 		o.copts.ReadBufferSize = s | ||||
|  |  | |||
							
								
								
									
										18
									
								
								server.go
								
								
								
								
							
							
						
						
									
										18
									
								
								server.go
								
								
								
								
							|  | @ -233,10 +233,11 @@ func newJoinServerOption(opts ...ServerOption) ServerOption { | |||
| 	return &joinServerOption{opts: opts} | ||||
| } | ||||
| 
 | ||||
| // WriteBufferSize determines how much data can be batched before doing a write on the wire.
 | ||||
| // The corresponding memory allocation for this buffer will be twice the size to keep syscalls low.
 | ||||
| // The default value for this buffer is 32KB.
 | ||||
| // Zero will disable the write buffer such that each write will be on underlying connection.
 | ||||
| // WriteBufferSize determines how much data can be batched before doing a write
 | ||||
| // on the wire. The corresponding memory allocation for this buffer will be
 | ||||
| // twice the size to keep syscalls low. The default value for this buffer is
 | ||||
| // 32KB. Zero or negative values will disable the write buffer such that each
 | ||||
| // write will be on underlying connection.
 | ||||
| // Note: A Send call may not directly translate to a write.
 | ||||
| func WriteBufferSize(s int) ServerOption { | ||||
| 	return newFuncServerOption(func(o *serverOptions) { | ||||
|  | @ -244,11 +245,10 @@ func WriteBufferSize(s int) ServerOption { | |||
| 	}) | ||||
| } | ||||
| 
 | ||||
| // ReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most
 | ||||
| // for one read syscall.
 | ||||
| // The default value for this buffer is 32KB.
 | ||||
| // Zero will disable read buffer for a connection so data framer can access the underlying
 | ||||
| // conn directly.
 | ||||
| // ReadBufferSize lets you set the size of read buffer, this determines how much
 | ||||
| // data can be read at most for one read syscall. The default value for this
 | ||||
| // buffer is 32KB. Zero or negative values will disable read buffer for a
 | ||||
| // connection so data framer can access the underlying conn directly.
 | ||||
| func ReadBufferSize(s int) ServerOption { | ||||
| 	return newFuncServerOption(func(o *serverOptions) { | ||||
| 		o.readBufferSize = s | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue