咖啡因读/写在高负载下花费的时间更长

这是我在春季启动中构建咖啡因缓存的方法:

caffeine.newBuilder()
                .initialCapacity(200000)
                .maximumSize(200000)
                .expireAfterWrite(15,TimeUnit.MINUTES)
                .scheduler(Scheduler.systemScheduler())
                .executor(caffeineWriteclientConnectionPool(cacheSpec))
                .recordStats(() -> caffeineMetrics)
                .writer(new CacheWriter<Object,Object>() {});

我使用以下同步方法:

cache.getallPresent() -> fetch all keys present in cache if not fallback to distributed cache/db and then add the key to the caffeine cache
cache.putAll() -> a key is added to the caffeine cache when its missed

当高速缓存负载很高时,我看到get / put时间增加了(> 100ms),这让我开始思考这些调用是否应该在hystrix后面,但是我认为将线程用于in -内存搜索?

此外,我看到GC经常发生,我相信这可能会影响读/写时间。关于设置GC的任何建议/最佳实践,或者我可以采取的其他一般建议来改善延迟?谢谢

nzjnzj 回答:咖啡因读/写在高负载下花费的时间更长

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2456770.html

大家都在问