Skip to content

Latest commit

 

History

History
191 lines (172 loc) · 38 KB

File metadata and controls

191 lines (172 loc) · 38 KB

GlobalConfig(全局配置)

全局配置定义了全局共享的配置,主要有容器,环境相关的配置。

配置详情

配置域 配置名称 配置类型 默认值 是否废弃 配置解释
global namespace string 环境类型,分正式环境(Production)和非正式环境(Development)两种类型,支持自定义
global env_name string 环境名称,非正式环境下多环境的名称
global container_name string 容器名称
global enable_set string 是否启动分set路由,默认不开启, Y 开启
global full_set_name string set 名称
global ext map 全局扩展参数

ServerConfig(服务端配置)

服务端配置定义了服务端相关配置、管理配置(AdminConfig)、服务映射列表配置(ServiceConfig) 服务映射配置(ServiceConfig)又包含了服务暴露列表配置(ProviderConfig)。

配置详情

配置域 配置名称 配置类型 默认值 是否废弃 配置解释
server app string 业务的应用名
server server string 业务的服务名
server local_ip string 127.0.0.1 本机ip
server nic string 本机网卡(eth1等),用于获取本机ip,如果配置了local_ip这个参数就不会生效。支持配置多个网卡,越靠前优先级越高,如eth1,eth2,eth3
server server_listener string 列表 注册服务端通用Listener, 实现 ServerListener 接口的类, 配置实现类的全路径
server close_timeout int 30000ms 关闭服务线程池的超时时间
server wait_timeout int 5000ms 反注册服务后,等待时间
server request_timeout int 2147483647 ms 请求超时时间(服务端全局)
server worker_pool string trpc_provider_biz_def 工作线程池名称,默认值
server filters string 列表 filter 列表配置
server enable_link_timeout boolean false 是否开启全链路超时,默认不开启
server config_center string 使用的配置中心[nacos]
server admin map admin 管理后台配置
server service map 暴露服务配置
server.admin admin_ip string 管理后台ip
server.admin admin_port int 管理后台端口
server.service name string 用于名字服务寻址
server.service version string v1.0.0 服务版本号
server.service group string normal 服务分组
server.service impls 列表 暴露服务的实现列表,根据实现找到接口
server.service.impls impl string 服务实现
server.service.impls worker_pool string 线程池名称
server.service.impls request_timeout string 超时时间
server.service.impls filters string 过滤器列表
server.service.impls enable_link_timeout string 全链路超时
server.service ip string 本机IP
server.service nic string 用于获取本机ip ,一般配置 ip
server.service port int 端口
server.service network string tcp 网络连接协议, [tcp、udp]
server.service protocol string trpc 通信协议,[trpc、http、rest]
server.service base_path string trpc 基础路径,前缀路径
server.service serialization string pb 序列化协议, [pb、json、jpb(java pb)]
server.service compressor string none 压缩方式, [none、gzip、snappy]
server.service compress_min_bytes int 65535 压缩最小字节数,默认64KB,即使开启压缩,但body小于该字节时,则强制不压缩
server.service transporter string netty transporter 服务端, [netty、jetty], jetty 需配合 protocol=http 一起使用
server.service charset string utf8 字符集
server.service keep_alive boolean true 是否保持长连接
server.service max_conns int 1024 * 20 最大连接数
server.service backlog int 1024 backlog大小,对应netty的 so_backlog
server.service send_buffer int 16384 发送缓冲区
server.service receive_buffer int 16384 接收缓冲区
server.service payload int 10485760(10M) 限制包大小
server.service idle_timeout int 180000ms 空闲时间
server.service request_timeout int 2147483647 ms 请求超时时间
server.service lazyinit boolean false 是否延迟初始化
server.service io_mode string epoll io模式 [epoll]
server.service io_thread_group_share boolean true io线程是否共享
server.service io_threads int cpus * 2 io线程数量
server.service boss_threads int 1 boss线程数量 接受请求的线程数量默认1为最优解,也根据实际场景可自行设置
server.service ext_map map 扩展配置
server.service worker_pool string trpc_provider_biz_def 线程池名称
server.service registrys map 多注册中心配置
server.service filters string 列表 filter 列表配置
server.service enable_link_timeout boolean false 是否开启全链路超时,默认不开启
server.service reuse_port boolean false 是否开启 reusePort 选项
server.service is_batch_decoder boolean true 是否开启批量解码
server.service explicit_flush_after_flushes int 2048 高吞吐量flush

ClientConfig(客户端配置)

服务端配置定义了客户端相关配置(netty等配置)、客户端映射列表配置(BackendConfig)。

配置详情

配置域 配置名称 配置类型 默认值 是否废弃 配置解释
client namespace string 环境类型,分正式环境(Production)和非正式环境(Development)两种类型, 不配置时使用全局配置
client request_timeout int 1000ms 客户端全局请求超时时间
client protocol string trpc (客户端全局)请求通信协议 [trpc、http]
client network string tcp (客户端全局)请求连接协议,[tcp, udp]
client serialization string PB (客户端全局)序列化协议,[pb、json、jpb(java pb)]
client compressor string none (客户端全局)压缩方式,[none、gzip、snappy]
client compress_min_bytes int 65535 (客户端全局)压缩最小字节数,默认64KB,即使开启压缩,但body小于该字节时,则强制不压缩
client charset string UTF-8 (客户端全局)字符集编码格式
client send_buffer int 16384 (客户端全局)发送缓冲区大小
client receive_buffer int 16384 (客户端全局)接收缓冲区大小
client keep_alive boolean true (客户端全局)是否保持长连接
client io_thread_group_share boolean true (客户端全局)是否是线程组共享模式
client io_threads int cpus * 2 (客户端全局)IO线程数量
client transporter string netty (客户端全局)transporter
client idle_timeout int 180000 ms (客户端全局)空闲超时时间
client lazyinit boolean false (客户端全局)是否延迟初始化
client conns_per_addr int 2 (客户端全局)单个addr连接数
client conn_timeout int 1000ms (客户端全局)客户端建立连接超时间
client worker_pool string trpc_consumer_biz_def (客户端全局)线程池id
client filters string 列表 (客户端全局)拦截器列表
client interceptors string 列表 (客户端全局)ClusterInvoker 拦截器,和filters之前拦截
client cluster_config_map map trpc客户端集群配置,代码已实现
client caller_service_name string (客户端全局)主调服务北极星名,polaris寻址支持
client service map trpc客户端配置
client.service name string "@BackendConfig(" + nameGeneratorIndex.getAndAdd(1) + ")" 后台集群名称(用于通过TRpcProxy查找)
client.service version string v1.0.0 服务版本号
client.service group string normal 服务分组
client.service interface string trpc 客户端具体接口
client.service naming_url string 路由发现 @Alias(target),java推荐使用.naming配置,直连 ip://ip:port, 名字服务: polaris://trpc.TestApp.TestServer.Greeter?key=value&key=value l5://mid:cmid cmlb://id
client.service naming_map map 扩展参数
client.service namespace string 环境类型,分正式环境(Production)和非正式环境(Development)两种类型, 不配置时使用全局配置
client.service callee string serviceName 主调信息
client.service network string tcp 网络连接协议, [tcp、udp]
client.service protocol string trpc 通信协议,[trpc、http])
client.service serialization string pb 序列化协议, [pb、json、jpb(java pb)]
client.service compressor string no 压缩方式, [none、gzip、snappy]
client.service compress_min_bytes int 65535 压缩最小字节数,默认64KB,即使开启压缩,但body小于该字节时,则强制不压缩
client.service transporter string netty transporter 服务端, [netty、jetty], jetty 需配合 protocol=http 一起使用
client.service charset string utf8 字符集
client.service keep_alive boolean true 是否保持长连接
client.service max_conns int 1024 * 20 客户端最大连接数
client.service send_buffer int 16384 发送缓冲区
client.service receive_buffer int 16384 接收缓冲区
client.service payload int 10485760(10M) 限制包大小
client.service idle_timeout int 180000ms 空闲时间
client.service request_timeout int 10000ms 请求超时时间
client.service conn_timeout int 1000ms 客户端建立连接超时间
client.service conns_per_addr int 2 客户端连接数
client.service lazyinit boolean false 是否延迟初始化
client.service io_thread_group_share boolean true io线程是否共享
client.service io_threads int cpus * 2 io线程数量
client.service ext_map map 扩展配置
client.service naming_map map 北极星扩展配置
client.service.naming_map metadata map 北极星元数据配置
client.service mock boolean false 是否mock, 默认 false
client.service mock_class string mock类
client.service worker_pool string trpc_consumer_biz_def 线程池名称
client.service filters string 列表 filter 列表配置
client.service is_batch_decoder boolean true 是否开启批量解码
client.service explicit_flush_after_flushes int 2048 高吞吐量flush
client.service caller_service_name string 主调服务北极星名,polaris寻址支持

PluginConfig(插件配置)

插件配置负责加载所有框架的插件配置

配置详情

首先列出支持的插件,然后是插件具体的配置参数。

插件列表

配置域 配置名称 配置类型 默认值 是否废弃 配置解释 已有实现
plugins worker_pool map 工作池 thread
plugins config string 远程配置 nacos
plugins filter string filter opentelemetry
plugins selector string 路由选择器 polaris, ip, zookeeper
plugins registry string 注册中心 polaris
plugins telemetry string 链路追踪 opentelemetry
plugins limiter string 限流 sentinel

worker_pool(线程池)

配置域 配置名称 配置类型 默认值 是否废弃 配置解释
plugins.worker_pool 'name'-线程池名称 map 线程池名称,及具体项目配置
plugins.worker_pool.name _type string 填写插件的名字,用于寻找插件,[default, thread, forkJoinPool],当该项不配置时,则使用 name 作为插件名称寻找插件
plugins.worker_pool.name core_pool_size int cpus * 2 核心线程数
plugins.worker_pool.name maximum_pool_size int cpus * 2 最大线程数量
plugins.worker_pool.name keep_alive_time_seconds int 60s 线程最长空闲时间
plugins.worker_pool.name queue_size int 0 队列大小 0 表示无限制
plugins.worker_pool.name allow_core_thread_timeout boolean true 是否超时回收核心线程
plugins.worker_pool.name name_prefix string 线程池中线程名称前缀
plugins.worker_pool.name deamon boolean true 是否是守护线程
plugins.worker_pool.name close_timeout int 10s 超时时间
plugins.worker_pool.name use_fiber boolean false 是否使用协程
plugins.worker_pool.name fiber_parallel int cpus 协程的调度线程池并行度级别
plugins.worker_pool.name share_schedule boolean true 协程池是否共享调度器
plugins.worker_pool.forkJoinPool parallel int 2 并行数
plugins.worker_pool.forkJoinPool timeoutMs int 2000 线程池关闭超时时间,单位毫秒