Java Appfog - Spring 应用程序 - 磁盘使用情况

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24570858/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 13:04:48  来源:igfitidea点击:

Appfog - Spring application - Disk usage

javamysqlspringappfog

提问by Azincourt

I have a Spring application running on Appfog.
App is connected to a Mysql DB and doesn't use disk storage (it only perform select or insert queries).
I noticed that the disk usage increasedconstantly in time (My database is very small, it can't be over 300MB).
This is a screenshot: enter image description here
Why disk usage doesn't remain fixed?
Thanks

我有一个在Appfog 上运行的 Spring 应用程序。
应用程序连接到一个 Mysql 数据库并且不使用磁盘存储(它只执行选择或插入查询)。
我注意到磁盘使用不断增加(我的数据库很小,不能超过 300MB)。
这是一个屏幕截图: 在此处输入图片说明
为什么磁盘使用率没有保持固定?
谢谢

回答by Matthias Steinbauer

We experienced similar behaviour with one of our apps. In our case we were using Hibernate with C3P0 resource pooling backed by EHCache as the storage backend provider. The default EHCache configuration has disk cache enabled which caches queries and loaded entities to the default Java temp dir. In cloud environments like Appfrog often the temp dir sits inside your user directory and thus accounts for your storage quota.

我们在我们的一个应用程序中遇到了类似的行为。在我们的例子中,我们使用 Hibernate 和 EHCache 作为存储后端提供程序支持的 C3P0 资源池。默认的 EHCache 配置启用了磁盘缓存,它将查询和加载的实体缓存到默认的 Java 临时目录。在像 Appfrog 这样的云环境中,临时目录通常位于您的用户目录中,因此会占用您的存储配额。

Obviously this cache can grow larger in size than the original database since the query cache may hold many different query results which can lead to data duplication in the disk cache.

显然,这个缓存的大小可以比原始数据库更大,因为查询缓存可能保存许多不同的查询结果,这可能导致磁盘缓存中的数据重复。