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
 | // be twice the size to keep syscalls low. The default value for this buffer is
 | ||||||
| // 32KB.
 | // 32KB.
 | ||||||
| //
 | //
 | ||||||
| // Zero will disable the write buffer such that each write will be on underlying
 | // Zero or negative values will disable the write buffer such that each write
 | ||||||
| // connection. Note: A Send call may not directly translate to a write.
 | // will be on underlying connection. Note: A Send call may not directly
 | ||||||
|  | // translate to a write.
 | ||||||
| func WithWriteBufferSize(s int) DialOption { | func WithWriteBufferSize(s int) DialOption { | ||||||
| 	return newFuncDialOption(func(o *dialOptions) { | 	return newFuncDialOption(func(o *dialOptions) { | ||||||
| 		o.copts.WriteBufferSize = s | 		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
 | // WithReadBufferSize lets you set the size of read buffer, this determines how
 | ||||||
| // much data can be read at most for each read syscall.
 | // 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
 | // The default value for this buffer is 32KB. Zero or negative values will
 | ||||||
| // a connection so data framer can access the underlying conn directly.
 | // disable read buffer for a connection so data framer can access the
 | ||||||
|  | // underlying conn directly.
 | ||||||
| func WithReadBufferSize(s int) DialOption { | func WithReadBufferSize(s int) DialOption { | ||||||
| 	return newFuncDialOption(func(o *dialOptions) { | 	return newFuncDialOption(func(o *dialOptions) { | ||||||
| 		o.copts.ReadBufferSize = s | 		o.copts.ReadBufferSize = s | ||||||
|  |  | ||||||
							
								
								
									
										18
									
								
								server.go
								
								
								
								
							
							
						
						
									
										18
									
								
								server.go
								
								
								
								
							|  | @ -233,10 +233,11 @@ func newJoinServerOption(opts ...ServerOption) ServerOption { | ||||||
| 	return &joinServerOption{opts: opts} | 	return &joinServerOption{opts: opts} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // WriteBufferSize determines how much data can be batched before doing a write on the wire.
 | // WriteBufferSize determines how much data can be batched before doing a write
 | ||||||
| // The corresponding memory allocation for this buffer will be twice the size to keep syscalls low.
 | // on the wire. The corresponding memory allocation for this buffer will be
 | ||||||
| // The default value for this buffer is 32KB.
 | // twice the size to keep syscalls low. The default value for this buffer is
 | ||||||
| // Zero will disable the write buffer such that each write will be on underlying connection.
 | // 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.
 | // Note: A Send call may not directly translate to a write.
 | ||||||
| func WriteBufferSize(s int) ServerOption { | func WriteBufferSize(s int) ServerOption { | ||||||
| 	return newFuncServerOption(func(o *serverOptions) { | 	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
 | // ReadBufferSize lets you set the size of read buffer, this determines how much
 | ||||||
| // for one read syscall.
 | // data can be read at most for one read syscall. The default value for this
 | ||||||
| // The default value for this buffer is 32KB.
 | // buffer is 32KB. Zero or negative values will disable read buffer for a
 | ||||||
| // Zero will disable read buffer for a connection so data framer can access the underlying
 | // connection so data framer can access the underlying conn directly.
 | ||||||
| // conn directly.
 |  | ||||||
| func ReadBufferSize(s int) ServerOption { | func ReadBufferSize(s int) ServerOption { | ||||||
| 	return newFuncServerOption(func(o *serverOptions) { | 	return newFuncServerOption(func(o *serverOptions) { | ||||||
| 		o.readBufferSize = s | 		o.readBufferSize = s | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue