If you haven’t heard of mongoDB, its a fast schema free document store. MongoDB uses Javascript as its query langauge, and uses a derivative of JSON called BSON for storing data. Currently the JavaScript engine used is spider monkey (Developed by Mozilla). If you checkout the lastest version of mongoDB you will be able to build it with google‘s V8 JavaScript engine support. The V8 engine powers google‘s new chrome browser, using this engine with mongoDB should give an amazing speed boost. This article will walk you thourgh building both V8 and mongoDB with V8 support on Ubuntu 9.10 32bit (64bit should be very similar).
First you will need to checkout the V8 engine source code. More information can be found at google.com/p/v8/”>http://code.google.com/p/v8/. Before we checkout the code you will need a few tools and libraries.
sudo apt-get install subversion git-core tcsh git-core scons g++ libpcre++-dev
sudo apt-get install libboost-dev libreadline-dev xulrunner-1.9.1-dev
We are now ready to checkout code.
svn checkout http://v8.googlecode.com/svn/trunk/ v8
cd v8
Now all the libraries and tools are in place to build V8. There is one issue with building on Ubuntu 9.10, but there is a workaround. The details for it can be found at google.com/p/v8/issues/detail?id=574″>http://code.google.com/p/v8/issues/detail?id=574. The basic fix is to comment out -Werror in the SConstruct file. In the current trunk version that I am using its on line 270 of the SConstruct file.
266 V8_EXTRA_FLAGS = {
267 'gcc': {
268 'all': {
269 'WARNINGFLAGS': ['-Wall',
270 #'-Werror',
271 '-W',
272 '-Wno-unused-parameter',
273 '-Wnon-virtual-dtor']
274 },
275 'os:win32': {
276 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long']
277 },
In order to build you run the scons command.
scons
This may take a few minutes to build, once completed we can move on to building mongoDB.
cd ..
git clone git://github.com/mongodb/mongo.git
cd mongo
You should now be in the root of the mongoDB project. From here we will be able to build the project. We will be using the same scons tool as we did with V8.
scons all --usev8
Once this process is completed, which could take a few minutes the mongodb executables will be in the current directory (mongo, mongod, etc..). When you start mongod it will be using the V8 engine.
Thats it folks enjoy mongoDB with V8 if you have any speed comparison, I would love to hear them you can post them in the comments. I plan on posting more details and some tricks on how to optimize the quires (Dates are a killer).
links:
monitoring.eu/wp-content/plugins/wp-o-matic/cache/0c461_HowsthecomBlog?d=yIl2AUoC8zA” border=”0″>
monitoring.eu/wp-content/plugins/wp-o-matic/cache/0c461_HowsthecomBlog?i=ldUdJ6iJVtU:Jo5Y-0WgpMs:V_sGLiPBpWU” border=”0″>
monitoring.eu/wp-content/plugins/wp-o-matic/cache/34b56_HowsthecomBlog?i=ldUdJ6iJVtU:Jo5Y-0WgpMs:F7zBnMyn0Lo” border=”0″>
monitoring.eu/wp-content/plugins/wp-o-matic/cache/34b56_HowsthecomBlog?i=ldUdJ6iJVtU:Jo5Y-0WgpMs:gIN9vFwOqvQ” border=”0″>
monitoring.eu/wp-content/plugins/wp-o-matic/cache/34b56_HowsthecomBlog?d=TzevzKxY174″ border=”0″>
monitoring.eu/wp-content/plugins/wp-o-matic/cache/34b56_HowsthecomBlog?d=qj6IDK7rITs” border=”0″>
monitoring.eu/wp-content/plugins/wp-o-matic/cache/34b56_ldUdJ6iJVtU” height=”1″ width=”1″ />
google.com/~r/HowsthecomBlog/~3/ldUdJ6iJVtU/” rel=”nofollow”>Go to Source