为什么 Cassandra 是用 Java 编写的? [英] Why was Cassandra written in Java?
问题描述
关于 Cassandra 的问题
为什么会有人用 Java 编写数据库引擎?
我能理解为什么你想要一个 Java 接口,但引擎...
我的印象是没有什么比 C/C++ 更快的了,数据库引擎不应该比最大速度慢,当然也不要使用垃圾收集......
谁能解释一下这有什么意义/为什么 Cassandra 可以比在 C/C++ 代码上运行的普通 SQL 更快?
很抱歉为什么是地球上的地狱"部分,但这对我来说真的没有任何意义.
我忽略了一个数据库,不像一般的花园式用户程序,只需要启动一次,然后运行很长时间,而且可能也是服务器上唯一的程序,这不言而喻重要的性能差异.
我更多地比较/参考了我在撰写本文时正在使用(或者更确切地说,更愿意使用)的功能失调"(委婉地说)Java 税收程序.
事实上,与使用 Java 编写税务程序不同,使用 Java 编写专用服务器程序非常有意义.
Question about Cassandra
Why the hell on earth would anybody write a database ENGINE in Java ?
I can understand why you would want to have a Java interface, but the engine...
I was under the impression that there's nothing faster than C/C++, and that a database engine shouldn't be any slower than max speed, and certainly not use garbage collection...
Can anybody explain me what possible sense that makes / why Cassandra can be faster than ordinary SQL that runs on C/C++ code ?
Sorry for the "Why the hell on earth" part, but it really didn't make any sense to me.
I neglected to consider that a database, unlike the average garden-varitety user programs, needs to be started only once and then runs for a very long time, and probably also as the only program on the server, which self-evidently makes for an important performance difference.
I was more comparing/referencing to a 'disfunctional' (to put it mildly) Java tax program I was using at the time of writing (or rather would have liked to use).
In fact, unlike using Java for tax programs, using Java for writing a dedicated server program makes perfect sense.
推荐答案
我可以看到几个原因:
- 安全性:用 Java 编写安全软件比用 C++ 编写安全软件更容易(还记得缓冲区溢出吗?)
- 性能:并没有那么糟糕.启动时肯定更糟,但是一旦代码启动并运行,这不是什么大事.实际上,您必须记住这里的一个重要点:VM 会不断优化 Java 代码,因此在某些情况下,它会比 C++ 更快
这篇关于为什么 Cassandra 是用 Java 编写的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!