<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marcelo Coraça de Freitas on Medium]]></title>
        <description><![CDATA[Stories by Marcelo Coraça de Freitas on Medium]]></description>
        <link>https://medium.com/@marcelocoraadefreitas?source=rss-cfc04b234ba5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ENhCWlNoJvGMBUf6.</url>
            <title>Stories by Marcelo Coraça de Freitas on Medium</title>
            <link>https://medium.com/@marcelocoraadefreitas?source=rss-cfc04b234ba5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 15:29:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marcelocoraadefreitas/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Graph DB — diving into JanusGraph part 1]]></title>
            <link>https://medium.com/finc-engineering/graph-db-diving-into-janusgraph-part-1f-199b807697d2?source=rss-cfc04b234ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/199b807697d2</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[graphdb]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[janusgraph]]></category>
            <dc:creator><![CDATA[Marcelo Coraça de Freitas]]></dc:creator>
            <pubDate>Tue, 25 Apr 2017 05:55:37 GMT</pubDate>
            <atom:updated>2017-05-01T09:37:54.210Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a 2 part article trying to clear out the way for newcomers to Graph Database technologies. In special, we will be focusing on <a href="http://janusgraph.org/">JanusGraph</a>. I&#39;ll try to explain to the best of my capabilities what <a href="http://janusgraph.org/">JanusGraph</a> is, and the related servers, so that users can continue from the <a href="http://docs.janusgraph.org/latest/">official documentation</a> with ease.</p><p>Also, this article was written on the verge of the first non-preview <a href="http://janusgraph.org/">JanusGraph</a> release, but it is highly probable that it has been released by the time you are reading this.</p><p>For those who are new to this world, <a href="http://janusgraph.org/">JanusGraph</a> is a fork of <a href="http://titan.thinkaurelius.com/">Titan DB</a>, an Open Source Graph DB server (even though this author finds this term a bit confusing and misleading — more on this later), which was maintained by basically one company that decided to discontinue it in favor of their new, closed source, product.</p><p>But, before we continue, it is important to notice a couple of things. It is assumed the reader has at least some level of familiarity with:</p><ol><li>SQL Server (any flavor — be it MS, MySQL, PgSQL, Oracle, …).</li><li>C-like language with OOP support (here we use Groovy).</li><li>familiarity with the fluent interface pattern (<a href="https://en.wikipedia.org/wiki/Fluent_interface">https://en.wikipedia.org/wiki/Fluent_interface</a>).</li></ol><h3>A tool for each problem</h3><p>For ages we had the SQL wars between vendors. MySQL users usually think SQL Server users are dumb and vice-versa. They both have benchmarks to support their point of view and they are both at the same time right and wrong.</p><p>See, there is not such thing as a one solution for every problem of man kind, and it is certainly the same for handling data. At some point, the usual tools are simply not enough. And if you saw yourself trying to figure out what is the best Graph DB server or the best data structure store chances are you already reached the limit of relational DB servers for your application.</p><p>Those new solutions are here to stay and they solve a very specific problem: how to handle large data sets in a specific situation. If you are looking for a solution that completely replaces your relational database, sorry; you won&#39;t find one. You might find some vendors that support more than one kind of database in a single product, but that is essentially the same as using multiple servers, each one where it excels the most.</p><p>Key value stores are usually great when you need fast access to complex structures based on some sort of ID. But if then you need to run complex queries into those stores, you are better off using a search engine such as Elasticsearch. You are then left with the issue of synchronizing your data across all those servers and it is usually a nice idea to rely on something like relational databases which enforce data constraints on your main data store.</p><p>Graph Databases are another type of those services trying to solve one specific problem: relations between data.</p><h3>Graph Databases</h3><p>When dealing with billions of entries in your database you often find yourself in situations where a simple join to return a couple of results take took long for an web application that must return something in a matter of a couple ms. Graphs are good solution in such cases, but not only.</p><p>The good thing about graph databases is that when using them, there is no need to go through your entire index to find what you are looking for. Instead, the relationships are stored alongside the vertices — not exactly in a centralized index (more on that in the next article). This inherently leads to very efficient queries and, thanks to a feature called <a href="http://docs.janusgraph.org/0.1.0-SNAPSHOT/indexes.html#vertex-indexes">vertex centric indexes,</a> you will be surprised to see how fast it is.</p><p>At <a href="https://finc.com/">FiNC</a>, the usage of Graph Database let us serve on real time what before, during our close beta, was taking 14h a day in batch processing with exponential growth. Now our Graph is updated nearly on real time and we are exploring new possibilities, as hadoop and DynamoDB integration.</p><p>In the next article I will cover the basics about the <a href="http://janusgraph.org/">JanusGraph</a> server. Until then.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=199b807697d2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finc-engineering/graph-db-diving-into-janusgraph-part-1f-199b807697d2">Graph DB — diving into JanusGraph part 1</a> was originally published in <a href="https://medium.com/finc-engineering">FiNC Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Graph DB — diving into JanusGraph part 2]]></title>
            <link>https://medium.com/finc-engineering/graph-db-diving-into-janusgraph-part-2-f4b9cbd967ac?source=rss-cfc04b234ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4b9cbd967ac</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[janusgraph]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[graphdb]]></category>
            <dc:creator><![CDATA[Marcelo Coraça de Freitas]]></dc:creator>
            <pubDate>Mon, 17 Apr 2017 10:31:26 GMT</pubDate>
            <atom:updated>2017-06-12T03:07:13.316Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the part 2 of a 2 articles series where I give an introduction on <a href="http://janusgraph.org/">JanusGraph</a> and Graph Database technologies.</p><p>In <a href="https://medium.com/p/199b807697d2">part 1</a> I went through some basic concepts and tried to explain that you shouldn&#39;t be considering this as a magic solution to all your problems. In this part however, I will be focusing on more practical aspects and will try to explain how the different parts surrounding <a href="http://janusgraph.org/">JanusGraph</a> are connected.</p><h3>Backend of the Backend</h3><p>Your JanusGraph server uses a storage back-end and an (optional, but very recommended) index back-end.</p><p>If your reaction right now is <em>&quot;what?&quot;</em> in a mix of despair and confusion, I get ya. I&#39;ve been there. That is why I think calling this a server is not necessarily the best idea. But now get this: you don&#39;t run JanusGraph server. You run Gremlin server with JanusGraph as the graph implementation.</p><p>It took me a while to sort through this out, so I decided to explain this in this article series. Actually, this is one of the main reasons for writing this in the first place. How to write queries and populate your DB is very well documented in the official docs. No need to cover this here.</p><p>But understanding some concepts is key for you to have a smooth ride in the <a href="http://janusgraph.org/">JanusGraph</a> world. So, please, read the following as many times as you need and make sure you completely understand the next sentence:</p><blockquote><a href="http://janusgraph.org/">JanusGraph</a> is an implementation of the Gremlin stack that stores and indexes the data in distributted a back-ends in an efficient way that let you handle huge amount of data efficiently.</blockquote><p>This has some implications:</p><ol><li><a href="http://janusgraph.org/">JanusGraph</a> can be embedded into a generic server, like gremlin-server.</li><li>You can use <a href="http://janusgraph.org/">JanusGraph</a> as a Java library in your app.</li><li>You can switch to different storage backends depending on your needs.</li><li>Indexing is optional, but you can also choose which indexing backend suits you better.</li><li>A <a href="http://janusgraph.org/">JanusGraph</a> instance is a program that connects to those backends and runs some graph processing using its libraries.</li></ol><p>Also, <a href="http://janusgraph.org/">JanusGraph</a> is aware of other running instances, and you can even kick other instances from one of the nodes in your cluster.</p><h3>(not so) practical example</h3><p>I thought a lot about writing a complex example with actual code. But this would take a long time to produce and wouldn&#39;t come even close to the quality of the examples contained in the official docs.</p><p>Instead, I decided to write a simple example to show where Graph Databases could effectively optimize your app.</p><p>Imagine an app like twitter, where users can follow each other:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*QJ8B_85IjV_niiyXYDP3DQ.jpeg" /></figure><p>In this example data set, the edges mean <em>follows</em> and vertices are the users. The arrow termination means who is following who and a double arrow means they follow each other.</p><p>This is the actual Graph model for this. Easy to understand and explain to non-technical people. The SQL mapping for this, however, would be something like:</p><ul><li>table <strong>users:</strong> id and name</li><li>table <strong>follows</strong>: source_user_id, target_user_id</li></ul><p>Now, imagine you wanna list followers of followers as potential user recommendation. With SQL your query would require at least 2 joins (assuming you are only interested in the user ids). And the result wouldn&#39;t filter out the users the current user is already following.</p><p>On top of that, it is completely ignoring the other side of this relationship.</p><p>A faster and more complete solution using a graph query could be:</p><blockquote>g.V().has(&#39;userId&#39;, userId).out(&#39;follows&#39;).aggregate(&#39;f&#39;).out(&#39;follows&#39;).where(without(&#39;f&#39;))</blockquote><p>Breaking down this query a little bit:</p><ul><li><strong>g.V():</strong> creates a graph traversal, which is an object that will be used to describe a strategy on how to navigate through the graph.</li><li><strong>has(&#39;userId&#39;, userId):</strong> looks for a vertex with the property userId set as the value of the variable userId.</li><li><strong>out(&#39;follows&#39;):</strong> this appears twice; it tells the traversal to go through the edges labeled as <em>follows</em> in an out direction (looking for users this particular user follows).</li><li><strong>aggregate(&#39;f&#39;): </strong>get the results of previous operation and save in this &quot;variable&quot;.</li><li><strong>where(without(&#39;f&#39;)):</strong> filter out users aggregated in the previous step.</li></ul><p>This strategy is then used to go through the vertices. You can also limit how many vertices are treated in any step along the way, to limit your results. And you could add weights to the edges based on properties such as similar attributes the users have (gender, age group, country, …). If instead of using <strong>out(&#39;follows&#39;)</strong> we used <strong>both(&#39;follows&#39;)</strong> it would consider both directions and using <strong>in(&#39;follows&#39;)</strong> it behaves the opposite way.</p><p>In a small enough data set this would be enough. But with real life applications, things are not that simple. For example, you will likelly have a user that follows hundreds of thousands of users. In this scenario you do need to limit your query, a subject that deserves its own article. But this extremely simple query already filters out the users being followed and on its own is already more powerful than the rather complex 2 joins SQL query.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4b9cbd967ac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finc-engineering/graph-db-diving-into-janusgraph-part-2-f4b9cbd967ac">Graph DB — diving into JanusGraph part 2</a> was originally published in <a href="https://medium.com/finc-engineering">FiNC Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>