Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RLocalCachedMap 有没有数量限制 #1974

Closed
zhou-hao opened this Issue Mar 11, 2019 · 8 comments

Comments

2 participants
@zhou-hao
Copy link

zhou-hao commented Mar 11, 2019

在同一个进程中维护大量的RLocalCachedMap会不会存在问题。如果会,该怎么处理。

@jackygurui

This comment has been minimized.

Copy link
Member

jackygurui commented Mar 12, 2019

如果是多个RLocalCachedMap实例都指向同一个redis key的情况,一般是不推荐的,除非你需要不同的实例里缓存不同的内容。使用多个实例的时候需要注意缓存策略的选择,以及内存容量的大小。

@zhou-hao

This comment has been minimized.

Copy link
Author

zhou-hao commented Mar 13, 2019

如果我有大量的RLocalCachedMap,怎么做比较好。每个map中的数据不多。读多写少。现在直接用的RMap。

@jackygurui

This comment has been minimized.

Copy link
Member

jackygurui commented Mar 13, 2019

建议逐个分析每个缓存的需求,预估一下内存使用的大小,判断合适的缓存策略,根据结果调整VM的GC和堆的大小。

@zhou-hao

This comment has been minimized.

Copy link
Author

zhou-hao commented Mar 14, 2019

感觉不好处理。还是先用RMap。再问下,在同一个RedissonClient实例下可以访问多个database吗。如果不能,创建多个RedissonClient实例会不会有影响,有什么好的实现方式。

@jackygurui

This comment has been minimized.

Copy link
Member

jackygurui commented Mar 15, 2019

用多个DB的情况需要使用多个RedissonClient实例。这种情况下可以考虑共享Executor和EventLoop。

@zhou-hao

This comment has been minimized.

Copy link
Author

zhou-hao commented Mar 15, 2019

好的,再问一个问题: 在使用EpollEventLoop时, 由于Config.addressResolverGroupFactory,默认值是MultiDnsAddressResolverGroupFactory,会无法启动:

java.lang.IllegalStateException: incompatible event loop type: io.netty.channel.epoll.EpollEventLoop
	at io.netty.channel.AbstractChannel$AbstractUnsafe.register(AbstractChannel.java:473)
	at io.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:80)
	at io.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:74)
	at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:333)
	at io.netty.bootstrap.AbstractBootstrap.register(AbstractBootstrap.java:234)
	at io.netty.resolver.dns.DnsNameResolver.<init>(DnsNameResolver.java:395)
	at io.netty.resolver.dns.DnsNameResolverBuilder.build(DnsNameResolverBuilder.java:430)
	at io.netty.resolver.dns.DnsAddressResolverGroup.newNameResolver(DnsAddressResolverGroup.java:114)
	at io.netty.resolver.dns.DnsAddressResolverGroup.newResolver(DnsAddressResolverGroup.java:94)
	at io.netty.resolver.dns.DnsAddressResolverGroup.newResolver(DnsAddressResolverGroup.java:79)
	at io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:69)
	... 20 common frames omitted

需要手动配置为: config.setAddressResolverGroupFactory(new DnsAddressResolverGroupFactory()); .这样配置有没有问题

@jackygurui

This comment has been minimized.

Copy link
Member

jackygurui commented Mar 21, 2019

@zhou-hao Epoll的EventLoop只能在Linux下运行

@zhou-hao

This comment has been minimized.

Copy link
Author

zhou-hao commented Mar 21, 2019

@jackygurui 看了下,在3.10.4已经修复了。

@zhou-hao zhou-hao closed this Mar 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.