Comments (9)
我没有你的环境,无法判断修改哪里有效。
后续建议用持续更新新功能的 FreeRedis,是全新重写的,支持更多功能。
from csredis.
FreeRedis,本地是没有问题,到客户有现场也有问题本地TongRds比客户现场高一版本,只能升级试一下了,
from csredis.
from csredis.
from csredis.
FreeRedis 的报错是连接超时,你在哨兵执行一下命令:
SENTINEL GET-MASTER-ADDR-BY-NAME sbcluster
看看返回什么,是不是可以连接的 IP,我猜返回的是内网IP,导致你的程序无法连接,连接超时。
csredis 的协议处理没有 FreeRedis 先进,对返回内容要求比较严格,我看你的截图返回的格式,应该是 TONG RDS 魔改过。
建议使用 FreeRedis
from csredis.
已经用FreeRedis, 不过多线程get性能测试慢50%左右
from csredis.
把测试代码和测试过程发一下
from csredis.
就并行一直读指定数量键值。
using XCRMS.Xcrs.PCL.Core;
using Xunit.Abstractions;
namespace XCRMS.DAL.Test.Cache {
[TestCaseOrderer("XCRMS.DAL.Test.TestCaseOrderer", "XCRMS.DAL.Test")]
public class TestRedis: BaseTest {
public TestRedis(ITestOutputHelper output) : base(output) {
}
[Theory(DisplayName = "01.init")]
[InlineData("aaa","11111")]
public void Test0(string key,string v ) {
RedisUtil.Set(key, v,36000);
// var aa = RedisUtil.Get2(key);
// Assert.Equal(v, aa);
}
[Theory(DisplayName = "02_02.getPerformace")]
[InlineData("aaa", 100)]
public void Test1_1(string key, int count) {
RedisUtil.Get<string>(key);
Parallel.For(0, count, i => {
var aa = RedisUtil.Get<string>(key);
if (aa != "11111") {
Output.WriteLine(aa);
}
}
);
}
}
}
RedisUtil 以前
public class RedisUtil : RedisHelper {
public static void Init(string conn) {
//哨兵模式
if (conn.StartsWith("[")) {
int eIndex = conn.IndexOf("]");
var servers = conn[1..eIndex].Split(new char[] { ','},StringSplitOptions.RemoveEmptyEntries);
Initialization(new CSRedisClient(conn[(eIndex + 1)..], servers));
}
else {
Initialization(new CSRedisClient(conn));
}
}
}
}
用FreeRedis
public class RedisUtil {
public static RedisClient cli;
public static void Init(string conn) {
//哨兵模式
if (conn.StartsWith("[")) {
int eIndex = conn.IndexOf("]");
var servers = conn[1..eIndex].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
string connStr = conn[(eIndex + 1)..];
cli = new RedisClient(connStr,servers, false);
}
else {
cli = new RedisClient(conn);
}
cli.Serialize = obj => JsonConvert.SerializeObject(obj);
cli.Deserialize = (json, type) => JsonConvert.DeserializeObject(json, type);
}
public static A Get<A>(string v) {
return cli.Get<A>(v);
}
之前也测试了,StackExchange.Redis
还是csredis最高。
from csredis.
请提供一个可以直接运行测试的 console app
from csredis.
Related Issues (20)
- centos 下重启应用报 订阅出错【r-xxxx:6389/8】:redis-server 连接已断开,3秒后重连。。。 HOT 2
- 订阅出错【r-xxxx:6389/8】:redis-server 连接已断开,3秒后重连。。。
- 连接redis 时redis未就绪,等redis启动完成后,执行xreadgroup报错:Unable to read data from the transport connection: Connection timed out HOT 14
- 可以让pub/sub直接发送或者接受byte[]参数吗? HOT 9
- Connection String Malformed when we using user and password HOT 1
- A memory leak occurs at CSRedisClient HOT 1
- 连接哨兵模式发布订阅节点错误 HOT 2
- 最近几天老是0点后一段时间 redis都报 MISCONF Redis is configured to save RDB snapshots HOT 4
- 请问有延迟队列的功能吗? HOT 1
- 3.8.671 vs 3.8.668 HOT 1
- 请问在哪里查看版本更新日志 HOT 2
- Thread CurrentCulture csredis hash exception with docker container HOT 15
- Linux 下面 Connection timed out.问题有办法解决吗? HOT 1
- 读取redis抛InvalidCastException HOT 1
- cacheshell哈希表不支持设置-1永久有效 HOT 3
- 请问可以监听redis键过期事件吗 HOT 1
- 请问一下有没有方法取消管道操作 HOT 4
- 这块每次 new byte对GC不太友好,还有读取的时候,建议使用 ArrayPool了
- 链接池中数量
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csredis.