All Projects → wmz7year → Thrift Connection Pool

wmz7year / Thrift Connection Pool

Licence: apache-2.0
Apache Thrift客户端连接池(client connection pool)

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Thrift Connection Pool

Thrifty
Thrift for Android that saves you methods
Stars: ✭ 476 (+706.78%)
Mutual labels:  thrift
Impala Java Client
Java client to connect directly to Impala using thrift
Stars: ✭ 26 (-55.93%)
Mutual labels:  thrift
Thrift2flow
Converts Thrift specs into Flow JavaScript type definitions
Stars: ✭ 39 (-33.9%)
Mutual labels:  thrift
Cpp Serializers
Benchmark comparing various data serialization libraries (thrift, protobuf etc.) for C++
Stars: ✭ 533 (+803.39%)
Mutual labels:  thrift
Zys
high performance service framework based on Yaf or Swoole
Stars: ✭ 812 (+1276.27%)
Mutual labels:  thrift
Pucket
Bucketing and partitioning system for Parquet
Stars: ✭ 29 (-50.85%)
Mutual labels:  thrift
Thriftpy2
Pure python approach of Apache Thrift.
Stars: ✭ 402 (+581.36%)
Mutual labels:  thrift
Tns
tns provides distributed solutions for thrift, support service discovery, high availability, load balancing, the gray release, horizontal scaling, and so on.
Stars: ✭ 53 (-10.17%)
Mutual labels:  thrift
Node Thrift2 Hbase
An HBase thrift wrapper for Node.js
Stars: ✭ 18 (-69.49%)
Mutual labels:  thrift
Spring Thrift Api Gateway
Gateway for Apache Thrift requests processing that is built on Spring Cloud stack
Stars: ✭ 38 (-35.59%)
Mutual labels:  thrift
Bender
An easy-to-use library for creating load testing applications
Stars: ✭ 583 (+888.14%)
Mutual labels:  thrift
Scrooge
A Thrift parser/generator
Stars: ✭ 724 (+1127.12%)
Mutual labels:  thrift
Node Impala
Node Client for Impala using Apache Thrift
Stars: ✭ 30 (-49.15%)
Mutual labels:  thrift
Srpc
RPC based on C++ Workflow
Stars: ✭ 521 (+783.05%)
Mutual labels:  thrift
Node Server Project
基于 node.js + express 技术栈,采用MVC结构设计、JWT + RESTful API、PM2服务监控的Node服务器端项目框架.
Stars: ✭ 47 (-20.34%)
Mutual labels:  thrift
Javaspringbootsamples
SpringBoot、Dubbo、SpringCloud的各种集成例子:Atomikos、gRPC、Thrift、Seata、ShardingSphere、Dubbo、Hmily、Nacos、Consul、Ribbon、Jedis、Lettuce、Redisson等框架
Stars: ✭ 399 (+576.27%)
Mutual labels:  thrift
Rpc proxy
基于thrift的服务注册和发现框架
Stars: ✭ 13 (-77.97%)
Mutual labels:  thrift
Thrift
Apache Thrift
Stars: ✭ 8,821 (+14850.85%)
Mutual labels:  thrift
Finagle
A fault tolerant, protocol-agnostic RPC system
Stars: ✭ 8,126 (+13672.88%)
Mutual labels:  thrift
Thriftclientpool
a thrift client connection pool & simple thrift use demo by golang
Stars: ✭ 32 (-45.76%)
Mutual labels:  thrift

#Thrift连接池实现

Join the chat at https://gitter.im/wmz7year/Thrift-Connection-Pool Build Status

##特性

  • 1、支持服务器之间的负载均衡
  • 2、每个服务器拥有一个独立的连接分区 所有的连接分区合并一起为整个连接池
  • 3、连接池支持自动创建连接、管理超时连接、管理失效连接
  • 4、支持服务器列表动态增加或者移除
  • 5、支持自动调取ping方法(在thrift描述文件添加方法void ping(),)检测连接可用性
  • 6、支持当服务不可用时自动将对应的服务器剔除连接池的功能
  • 7、添加多服务接口支持

###下载

<dependency>
        <groupId>com.github.wmz7year</groupId>
        <artifactId>ThriftConnectionPool</artifactId>
        <version>1.0.6-RELEASE</version>
</dependency>

###示例 ####单服务示例 ThriftConnectionPoolConfig config = new ThriftConnectionPoolConfig(); config.setConnectTimeout(3000); config.setThriftProtocol(TProtocolType.BINARY); config.setClientClass(Example.Client.class); config.addThriftServer("127.0.0.1", 9119); config.setMaxConnectionPerServer(2); config.setMinConnectionPerServer(1); config.setIdleMaxAge(2, TimeUnit.SECONDS); config.setMaxConnectionAge(2); config.setLazyInit(false); try { ThriftConnectionPool<Example.Client> pool = new ThriftConnectionPool<Example.Client>(config); Example.Client client = pool.getConnection().getClient(); client.ping(); pool.close(); } catch (ThriftConnectionPoolException e) { e.printStackTrace(); } catch (TException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }

####多接口服务示例 ThriftConnectionPoolConfig config = new ThriftConnectionPoolConfig(ThriftServiceType.MULTIPLEXED_INTERFACE); config.setConnectTimeout(3000); config.setThriftProtocol(TProtocolType.BINARY); config.addThriftServer("127.0.0.1", 9119); config.addThriftClientClass("other", Other.Client.class); config.addThriftClientClass("example", Example.Client.class);

config.setMaxConnectionPerServer(2);
config.setMinConnectionPerServer(1);
config.setIdleMaxAge(2, TimeUnit.SECONDS);
config.setMaxConnectionAge(2);
config.setLazyInit(false);
config.setAcquireIncrement(2);
config.setAcquireRetryDelay(2000);

config.setAcquireRetryAttempts(1);
config.setMaxConnectionCreateFailedCount(1);
config.setConnectionTimeoutInMs(5000);

config.check();

ThriftConnectionPool<TServiceClient> pool = new ThriftConnectionPool<TServiceClient>(config);
ThriftConnection<TServiceClient> connection = pool.getConnection();
// example service
com.wmz7year.thrift.pool.example.Example.Client exampleServiceClient = connection.getClient("example",
		Example.Client.class);
exampleServiceClient.ping();

// other service
com.wmz7year.thrift.pool.example.Other.Client otherServiceClient = connection.getClient("other",
		Other.Client.class);
otherServiceClient.ping();
pool.close();

####接下来需要完善内容: 1、补充文档
2、补充性能测试
3、完善使用例子
4、操作重试机制?

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].