For my social news stream application I am heavily thinking about the right software to support my backend. After I designed a database model in MySQL I talked back to Jonas and he suggested to search for a better suiting technology. A little bit of research brought me to a Graph database called Neo4j.

After I downloaded the opensource java libs and got it running with eclipse and maven I did some testing with my Metalcon data set. And I have been very satisfied and the whole project looks very promesing to me. I exported 4 relations from my MySQL Database.

  1. UserUserFriend containing all the friendship requests
  2. UserProfileVisit containing the profiles a user visited
  3. UserMessage containing the messages between users
  4. UserComment containing the profile comments between users

These relations obviously form a graph on my data set. Reading the several 100’000 lines of data and put them into the graph data structure and building a search index on the nodes only took several seconds runtime. But I was even more impressed by the speed with which it was possible to traverse the graph!

Receiving the shortest path between two users of length 4 only took me 150 milliseconds. Doing a full bredthfirst search on a different heavily connected graph with 290’000 edges only took 2.7 seconds which means that neo4j is capable of traversing about 100’000 edges per second.

Now I will have to look more carefully to my usecase. Obviously I want to have edges that are labled with timestamps and retrieve them in orderd lists. Adding key value pairs to the edges and including and index is possible which makes me optimisitic that I will be able to solve a lot of my queries of interest in an efficiant manner.

Unfortunately I am batteling around with Google Webtoolkit and Eclipse and Neo4j which I want to combine for the new metlcon version but I even asked the neo4j mailinglist with an very emberassing question and the guys from neotechnology have been very kind and helpful (even thogh I still couldn’t manage to get it running) I will post an article here as soon as I know how to set everything up.

In General I am still a huge fan of relational databases but for a usecase of social networks I see why graph data bases seem to be the more sophisticated technology. I am pretty sure that I could not have perfomed so well using MySQL.

What is your experience with graph data bases and especially neo4j?

If you like this post, you might like these related posts:

  1. Time lines and news streams: Neo4j is 377 times faster than MySQL Over the last weeks I did some more work on...
  2. neo4j based social news feed demo on wikipedia graph running UPDATE: you can find an evaluation of the following blog...
  3. Get the full neo4j power by using the Core Java API for traversing your Graph data base instead of Cypher Query Language As I said yesterday I have been busy over the...
  4. Amazed by neo4j, gwt and my apache tomcat webserver edit: the demo is finally online but on a different...
  5. GWT + database connection in Servlet ContextListener – Auto Complete Video Tutorial Part 5 Finally we have all the basics that are needed for...

Sharing:

Tags: , , , , , ,

3 Comments on Neo4j Graph Database vs MySQL

  1. [...] stated before I did my first testings with Neo4j. Now I wanted to include Neo4j to GWT which is actually very straight forward but for some reasons I [...]

  2. It’s normal that natural form of representation that kind of data is a graph – performance will be always better. I worked on navigation project which was on mysql too. We have really big problems with performance. One route calculation took 42 seconds. A bunch of developers tried to optimize it, when i was trying to convince old method architects to use neo4j. When they gave up at optimalization i get 2 weeks for test neo4j. The result was 5-50ms in calculation. After that i have made some modifications in graph-algo module for navigation purposes. This navigation is socially enabled so it’s ready to work fast. One annoying thing for me is that you can’t use neo4j in embedded mode and connect with webadmin to observe your database. I am waiting or I will write GIS routing on neo4j in the neo4j-spatial module. The importing from OSM is working few months ago, so maybe i will try to expand it.
    My bechelors work subject is not yet formed. I said only that it would be Scala and GIS :)

  3. [...] A publish/subscribe system seems promising, but how can I combine it with a recommender system? Graph databases are good for querying the social graph, but key-value stores could also be a good choice. Or maybe a hybrid system is [...]

Leave a Reply

*

Close

Subscribe to my newsletter

You don't like mail?