Giter VIP home page Giter VIP logo

Comments (4)

zsy619 avatar zsy619 commented on July 21, 2024

CSRedis.ConnectionPool.GetConnection 连接池获取超时(10秒)

from csredis.

2881099 avatar 2881099 commented on July 21, 2024

poolsize设置多少,最好写一个接口,监控pool状态

	[HttpGet(@"connection/redis")]
	public object GetConnectionRedis() {
		var ret = new Hashtable();
		foreach(var pool in RedisHelper.ClusterNodes) {
			List<Hashtable> list = new List<Hashtable>();
			foreach (var conn in pool.Value.AllConnections) {
				list.Add(new Hashtable() {
					{ "最后活动", conn.LastActive },
					{ "获取次数", conn.UseSum }
				});
			}
			ret.Add(pool.Key, new {
				FreeConnections = pool.Value.FreeConnections.Count,
				AllConnections = pool.Value.AllConnections.Count,
				GetConnectionQueue = pool.Value.GetConnectionQueue.Count,
				GetConnectionAsyncQueue = pool.Value.GetConnectionAsyncQueue.Count,
				List = list
			});
		}
		return ret;
	}

from csredis.

zsy619 avatar zsy619 commented on July 21, 2024

RedisHelper.ClusterNodes 这个是否为所有的节点
我这边用了5个redis库,
public static CSRedis.CSRedisClient RedisClusterX { get; set; }
public static CSRedis.CSRedisClient RedisSentinelX { get; set; }
public static CSRedis.CSRedisClient RedisCacheX { get; set; }
public static CSRedis.CSRedisClient RedisQueueX { get; set; }
public static CSRedis.CSRedisClient RedisBalanceX { get; set; }
这个方法是否能监控到这5个redis的所有链接情况

from csredis.

2881099 avatar 2881099 commented on July 21, 2024

不是,RedisHelper有自己的CSRedisClient实例。你的这五个实例,各种有独立的连接池,循环上面我发的链接池监控

	[HttpGet(@"connection/redis")]
	public object GetConnectionRedis() {
var redisclients = new [] { 你定义的五个对象 };
var allret = new Hashtable();
foreach (var redis in redisclients) {
		var ret = new Hashtable();
		foreach(var pool in redis.ClusterNodes) {
			List<Hashtable> list = new List<Hashtable>();
			foreach (var conn in pool.Value.AllConnections) {
				list.Add(new Hashtable() {
					{ "最后活动", conn.LastActive },
					{ "获取次数", conn.UseSum }
				});
			}
			ret.Add(pool.Key, new {
				FreeConnections = pool.Value.FreeConnections.Count,
				AllConnections = pool.Value.AllConnections.Count,
				GetConnectionQueue = pool.Value.GetConnectionQueue.Count,
				GetConnectionAsyncQueue = pool.Value.GetConnectionAsyncQueue.Count,
				List = list
			});
		}
		allret.Add(1, ret);
}
    return allret;

}

from csredis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.