JVM为什么不从数据库加载类? [英] Why doesn't the JVM load classes from a database?

查看:62
本文介绍了JVM为什么不从数据库加载类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Java虚拟机不能从数据库中加载类(类似于.NET的GAC)?据我了解,当前它必须读取并扫描类路径上每个JAR的清单,以便找到类文件.不会使用数据库(如SQLite)增加启动时间吗?

Why doesn't the Java virtual machine load classes from a database (similar to the GAC of .NET)? As I understand it, currently it has to read and scan the manifests of each JAR on the class path in order to locate class files. Wouldn't using a database (like SQLite) boost startup time?

推荐答案

这取决于IBM和IBM(共享数据)已经具有加速启动并减少内存占用的技术.

Depending on how you define "database" both IBM (shared classes) and Oracle (shared data) already do have technologies to speed up startup and decrease memory footprint.

类的加载时间实际上很小(基于类的时间),因此以这种方式添加数据库之类的东西实际上并不会很好地改变您的性能,尤其是当您必须将字节数扩展到一个字节时.连线(而不是简单地读取本地文件系统jar条目).当今所有的JVM在类加载路径上都进行了高度优化,添加SQL当然对性能没有帮助. (分布式存储库的灵活性等是一个不同的问题,我在那里看到了优势.)

Class load time is actually very small (on a class by class basis), so adding something like a database in the way won't realistically change you performance in a good way, especially if you have to blast the bytes over a wire (rather than simply read a local file system jar entry). All the JVMs today are highly optimized down the class loading path and adding SQL will certainly not help for performance. (flexibility of distributed repositories, etc.. is a different question and I see advantages there.)

这篇关于JVM为什么不从数据库加载类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆