Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why was Cassandra written in Java? [closed]

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 ?

Edit:
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.

like image 374
Stefan Steiger Avatar asked Feb 26 '10 13:02

Stefan Steiger


People also ask

Is cassandra written in Java?

Cassandra is a distributed database management system which is open source with wide column store, NoSQL database to handle large amount of data across many commodity servers which provides high availability with no single point of failure. It is written in Java and developed by Apache Software Foundation.

Why cassandra needs Java?

And, with regards to performance, Java systems can easily be faster than equivalent C++ systems, not because of underlying language or JVM but just because one can spend more time on design and optimizations, rather than having to write, say, custom memory management subsystem.

What language is cassandra?

The Cassandra Query Language (CQL) is the primary language for communicating with the Apache Cassandra™ database. The most basic way to interact with Apache Cassandra is using the CQL shell, cqlsh. Using cqlsh, you can create keyspaces and tables, insert and query tables, plus much more.


2 Answers

What do you mean, C++? Hand coded assembly would be faster if you have a few decades to spare.

like image 53
Martin Avatar answered Oct 02 '22 08:10

Martin


I can see a few reasons:

  • Security: it's easier to write secure software in Java than in C++ (remember the buffer overflows?)
  • Performance: it's not THAT worse. It's definitely worse at startup, but once the code is up and running, it's not a big thing. Actually, you have to remember an important point here: Java code is continually optimized by the VM, so in some circumstances, it gets faster than C++
like image 26
Kico Lobo Avatar answered Oct 02 '22 09:10

Kico Lobo