<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>openstack — jd:/dev/blog</title><description>Posts tagged &quot;openstack&quot; on jd:/dev/blog.</description><link>https://julien.danjou.info/</link><item><title>Gnocchi 4.3.0 released</title><link>https://julien.danjou.info/blog/gnocchi-4-3-0-released/</link><guid isPermaLink="true">https://julien.danjou.info/blog/gnocchi-4-3-0-released/</guid><description>This new release minor release of Gnocchi has been a bit longer than usual, but here it is!</description><pubDate>Mon, 30 Jul 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This new release minor release of Gnocchi has been a bit longer than usual, but here it is!&lt;/p&gt;
&lt;p&gt;So what&apos;s new in this version of Gnocchi? Well, according to &lt;a href=&quot;https://gnocchi.xyz/releasenotes/4.3.html&quot;&gt;the release notes&lt;/a&gt;, not much. There are only two new features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;gnocchi-injector&lt;/em&gt; which allows injecting data for &lt;em&gt;metricd&lt;/em&gt; consumption directly. This is useful to test &lt;em&gt;metricd&lt;/em&gt; performances.&lt;/li&gt;
&lt;li&gt;The ability for the &lt;code&gt;/v1/aggregation/resources&lt;/code&gt; endpoint to read a string rather than a JSON formatted payload for filtering.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nothing exciting here… however, other changes are not user-visible and are not in those notes:&lt;/p&gt;
&lt;p&gt;Performance boost, everywhere!&lt;/p&gt;
&lt;p&gt;The storage engine has been largely improved to batch a ton of operations that used to be done on a per-metric basis. When ingesting new measures, Gnocchi was storing those new points in batch. However, the processing done by &lt;em&gt;metricd&lt;/em&gt; later was single-metric based for most it. This did not leverage the efficiency that some backend might have and would create more I/O operations than necessary.&lt;/p&gt;
&lt;p&gt;Each incoming data sack is now processed in batch mode, making &lt;em&gt;metricd&lt;/em&gt; much faster at aggregating metrics data! When doing local benchmarks, some scenario presented an improvement of 8x.&lt;/p&gt;
&lt;p&gt;This new storage internal API is not used by the REST API yet, as many operations exposed by the API are oriented for a single metric. That might be a significant improvement for the next version of Gnocchi&apos;s API.&lt;/p&gt;
&lt;p&gt;Happy upgrade!&lt;/p&gt;
</content:encoded><category>open-source</category><category>openstack</category></item><item><title>Lessons from OpenStack Telemetry: Deflation</title><link>https://julien.danjou.info/blog/lessons-from-openstack-telemetry-deflation/</link><guid isPermaLink="true">https://julien.danjou.info/blog/lessons-from-openstack-telemetry-deflation/</guid><description>This post is the second and final episode of Lessons from OpenStack Telemetry. If you have missed the first post, you can read it here.</description><pubDate>Thu, 19 Apr 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This post is the second and final episode of &lt;em&gt;Lessons from OpenStack Telemetry&lt;/em&gt;. If you have missed the first post, you can read it &lt;a href=&quot;https://julien.danjou.info/blog/lessons-from-openstack-telemetry-incubation&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Splitting&lt;/h2&gt;
&lt;p&gt;At some point, the rules relaxed on new projects addition with the Big Tent initiative, allowing us to rename ourselves to the OpenStack Telemetry team and splitting Ceilometer into several subprojects: Aodh (alarm evaluation functionality) and Panko (events storage). Gnocchi was able to join the OpenStack Telemetry party for its first anniversary.&lt;/p&gt;
&lt;p&gt;Finally being able to split Ceilometer into several independent pieces of software allowed us to tackle technical debt more rapidly. We built autonomous teams for each project and gave them the same liberty they had in Ceilometer. The cost of migrating the code base to several projects was higher than we wanted it to be, but we managed to build a clear migration path nonetheless.&lt;/p&gt;
&lt;h2&gt;Gnocchi Shamble&lt;/h2&gt;
&lt;p&gt;With Gnocchi in town, we stopped all efforts on Ceilometer storage and API and expected people to adopt Gnocchi. What we underestimated is the unwillingness of many operators to think about telemetry. They did not want to deploy anything to have telemetry features in the first place, so adding yet a new component (a timeseries database) to have proper metric features was seen a burden – and sometimes not seen at all.&lt;br /&gt;
Indeed, we also did not communicate enough on our vision for that transition. After two years of existence, many operators were asking what Gnocchi was and what they needed it for. They deployed Ceilometer and its bogus storage and API and were confused about needing yet another piece of software.&lt;/p&gt;
&lt;p&gt;It took us more than two years to deprecate the Ceilometer storage and API, which is way too long.&lt;/p&gt;
&lt;h2&gt;Deflation&lt;/h2&gt;
&lt;p&gt;In the meantime, people were leaving the OpenStack boat. Soon enough, we started to feel the shortage of human resources. Smartly, we never followed the OpenStack trend of imposing blueprints, specs, bug reports or any process to contributors, obeying my list of &lt;a href=&quot;https://julien.danjou.info/blog/foss-projects-management-bad-practice&quot;&gt;open source best practice&lt;/a&gt;. This flexibility allowed us to iterate more rapidly; compared to other OpenStack projects; we were going faster proportionately to the size of our contributor base.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://images.unsplash.com/photo-1520018319835-74bf61f79844?ixlib=rb-0.3.5&amp;amp;q=80&amp;amp;fm=jpg&amp;amp;crop=entropy&amp;amp;cs=tinysrgb&amp;amp;w=1080&amp;amp;fit=max&amp;amp;ixid=eyJhcHBfaWQiOjExNzczfQ&amp;amp;s=7b410a77641efbb205b4157f7b4c62b0&quot; alt=&quot;Capturer Le moment&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Nonetheless, we felt like bailing out a sinking ship. Our contributors were disappearing while we were swamped with technical debt: half-baked feature, unfinished migration, legacy choices and temporary hacks. After the big party that happened, we had to wash the dishes and sweep the floor.&lt;/p&gt;
&lt;p&gt;Being part of OpenStack started to feel like a burden in many ways. The inertia of OpenStack being a big project was beginning to surface, so we put up a lot of efforts to dodge most of its implications. Consequently, the team was perceived as an outlier, which does not help, especially when you have to interact with a lot your neighbors.&lt;/p&gt;
&lt;p&gt;The OpenStack Foundation never understood the organization of our team. They would refer to us as &quot;Ceilometer&quot; whereas we formally renamed ourselves to &quot;Telemetry&quot; since we were englobing four server projects and a few libraries. For example, while Gnocchi has been an OpenStack project for two years before leaving, it has never been listed on the &lt;a href=&quot;https://www.openstack.org/software/project-navigator/&quot;&gt;project navigator&lt;/a&gt; maintained by the foundation.&lt;/p&gt;
&lt;p&gt;That&apos;s a funny anecdote that demonstrates the peculiarity of our team, and how it has been both a strength and a weakness.&lt;/p&gt;
&lt;h2&gt;Competition&lt;/h2&gt;
&lt;p&gt;Nobody was trying to do what we were doing when we started Ceilometer. We filled the space of metering OpenStack. However, as the number of companies involved increased and the friction with it along, some people grew unhappy. The race to have a seat at the table of the feast and becoming a &lt;em&gt;Project Team Leader&lt;/em&gt; was strong, so some people preferred to create their project rather than trying to play the contribution game. In many areas, including our, that divided the effort up to a ridiculous point where several teams where doing the exact the same thing, or were trying to step on each other toes to kill the competitors.&lt;/p&gt;
&lt;p&gt;We spent a significant amount of time trying to bring other teams in the Telemetry scope, to unify our efforts, without much success. Some companies were not embracing open-source because of their cultural differences, while some others had no interest to join a project where they would not be seen as the leader.&lt;/p&gt;
&lt;p&gt;That fragmentation did not help us, but also did not do much harm in the end. Most of those projects are now either dead or becoming irrelevant as the rest of the world caught up on what they were trying to do.&lt;/p&gt;
&lt;h2&gt;Epilogue&lt;/h2&gt;
&lt;p&gt;As of 2018, I&apos;m the PTL for Telemetry – because nobody else ran. The official list of maintainer for the telemetry projects is five people: two are inactive, and three are part-time. During the latest development cycle (Queens), 48 people committed in Ceilometer, though only three developers made impactful contributions. The code size has been divided by two since the peak: Ceilometer is now 25k lines of code long.&lt;/p&gt;
&lt;p&gt;Panko and Aodh have no active developer. A Red Hat colleague and I are maintaining the projects afloat to keep it working.&lt;/p&gt;
&lt;p&gt;Gnocchi has humbly thriven since it left OpenStack. The stains from having been part of OpenStack are not yet all gone. It has a small community, but users see its real value and enjoy using it.&lt;/p&gt;
&lt;p&gt;Those last six years have been intense, and riding the OpenStack train has been amazing. As I concluded in the first blog post of this series, most of us had a great time overall; the point of those writings is not to complain, but to reflect.&lt;/p&gt;
&lt;p&gt;I find it fascinating to see how the evolution of a piece of software and the metamorphosis of its community are entangled. The amount of politics that a corporately-backed project of this size generates is majestic and has a prominent influence on the outcome of software development.&lt;/p&gt;
&lt;p&gt;So, what&apos;s next? Well, as far as Ceilometer is concerned, we still have ideas and plans to keep shrinking its footprint to a minimum. We hope that one-day Ceilometer will become irrelevant – at least that&apos;s what we&apos;re trying to achieve so we don&apos;t have anything to maintain. That mainly depends on how the myriad of OpenStack projects will chose to address their metering.&lt;/p&gt;
&lt;p&gt;We don&apos;t see any future for Panko nor Aodh.&lt;/p&gt;
&lt;p&gt;Gnocchi, now blooming outside of OpenStack, is still young and promising. We&apos;ve plenty of ideas and every new release brings new fancy features. The storage of timeseries at large scale is exciting. Users are happy, and the ecosystem is growing.&lt;/p&gt;
&lt;p&gt;We&apos;ll see how all of that concludes, but I&apos;m sure it&apos;ll be new lessons to learn and write about in six years!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>Lessons from OpenStack Telemetry: Incubation</title><link>https://julien.danjou.info/blog/lessons-from-openstack-telemetry-incubation/</link><guid isPermaLink="true">https://julien.danjou.info/blog/lessons-from-openstack-telemetry-incubation/</guid><description>It was mostly around that time in 2012 that I and a couple of fellow open-source enthusiasts started working on Ceilometer, the first piece of software from the OpenStack Telemetry project. Six years</description><pubDate>Thu, 12 Apr 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;It was mostly around that time in 2012 that I and a couple of fellow open-source enthusiasts started working on Ceilometer, the first piece of software from the OpenStack Telemetry project. Six years have passed since then. I&apos;ve been thinking about this blog post for several months (even years, maybe), but lacked the time and the hindsight needed to lay out my thoughts properly. In a series of posts, I would like to share my observations about the Ceilometer development history.&lt;/p&gt;
&lt;p&gt;To understand the full picture here, I think it is fair to start with a small retrospective on the project. I&apos;ll try to keep it short, and it will be unmistakably biased, even if I&apos;ll do my best to stay objective – bear with me.&lt;/p&gt;
&lt;h2&gt;Incubation&lt;/h2&gt;
&lt;p&gt;Early 2012, I remember discussing with the first Ceilometer developers the right strategy to solve the problem we were trying to address. The company I worked for wanted to run a public cloud, and billing the resources usage was at the heart of the strategy. The fact that no components in OpenStack were exposing any consumption API was a problem.&lt;/p&gt;
&lt;p&gt;We debated about how to implement those metering features in the cloud platform. There were two natural solutions: either achieving some resource accounting report in each OpenStack projects or building a new software on the side, covering for the lack of those functionalities.&lt;/p&gt;
&lt;p&gt;At that time there were only less than a dozen of OpenStack projects. Still, the burden of patching every project seemed like an infinite task. Having code reviewed and merged in the most significant projects took several weeks, which, considering our timeline, was a show-stopper. We wanted to go fast.&lt;/p&gt;
&lt;p&gt;Pragmatism won, and we started implementing Ceilometer using the features each OpenStack project was offering to help us: very little.&lt;/p&gt;
&lt;p&gt;Our first and obvious candidate for usage retrieval was Nova, where Ceilometer aimed to retrieves statistics about virtual machines instances utilization. Nova offered no API to retrieve those data – and still doesn&apos;t. Since it was out of the equation to wait several months to have such an API exposed, we took the shortcut of polling directly libvirt, Xen or VMware from Ceilometer.&lt;/p&gt;
&lt;p&gt;That&apos;s precisely how temporary hacks become historical design. Implementing this design broke the basis of the abstraction layer that Nova aims to offer.&lt;/p&gt;
&lt;p&gt;As time passed, several leads were followed to mitigate those trade-offs in better ways. But on each development cycle, getting anything merged in OpenStack became harder and harder. It went from patches long to review, to having a long list of requirements to merge anything. Soon, you&apos;d have to create a blueprint to track your work, write a full specification linked to that blueprint, with that specification being reviewed itself by a bunch of the so-called core developers. The specification had to be a thorough document covering every aspect of the work, from the problem that was trying to be solved, to the technical details of the implementation. Once the specification was approved, which could take an entire cycle (6 months), you&apos;d have to make sure that the Nova team would make your blueprint a priority. To make sure it was, you would have to fly a few thousands of kilometers from home to an OpenStack Summit, and orally argue with developers in a room filled with hundreds of other folks about the urgency of your feature compared to other blueprints.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/04/ods_1-tripleo_design_session.jpg&quot; alt=&quot;An OpenStack design session in Hong-Kong, 2013&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Even if you passed all of those ordeals, the code you&apos;d send could be rejected, and you&apos;d get back to updating your specification to shed light on some particular points that confused people. Back to square one.&lt;/p&gt;
&lt;p&gt;Nobody wanted to play that game. Not in the Telemetry team at least.&lt;/p&gt;
&lt;p&gt;So Ceilometer continued to grow, surfing the OpenStack hype curve. More developers were joining the project every cycle – each one with its list of ideas, features or requirements cooked by its in-house product manager.&lt;/p&gt;
&lt;p&gt;But many features did not belong in Ceilometer. They should have been in different projects. Ceilometer was the first OpenStack project to pass through the OpenStack Technical Committee incubation process that existed before the rules were relaxed.&lt;/p&gt;
&lt;p&gt;This incubation process was uncertain, long, and painful. We had to justify the existence of the project, and many technical choices that have been made. Where we were expecting the committee to challenge us at fundamental decisions, such as breaking abstraction layers, it was mostly nit-picking about Web frameworks or database storage.&lt;/p&gt;
&lt;h2&gt;Consequences&lt;/h2&gt;
&lt;p&gt;The rigidity of the process discouraged anyone to start a new project for anything related to telemetry. Therefore, everyone went ahead and started dumping its idea in Ceilometer itself. With more than ten companies interested, the frictions were high, and the project was at some point pulled apart in all directions. This phenomenon was happening to every OpenStack projects &lt;em&gt;anyway&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;On the one hand, many contributions brought marvelous pieces of technology to Ceilometer. We implemented several features you still don&apos;t find any metering system. Dynamically sharded, automatic horizontally scalable polling? Ceilometer has that for years, whereas you can&apos;t have it in, e.g., Prometheus.&lt;/p&gt;
&lt;p&gt;On the other hand, there were tons of crappy features. Half-baked code merged because somebody needed to ship something. As the project grew further, some of us developers started to feel that this was getting out of control and could be disastrous. The technical debt was growing as fast as the project was.&lt;/p&gt;
&lt;p&gt;Several technical choices made were definitely &lt;em&gt;bad&lt;/em&gt;. The architecture was a mess; the messaging bus was easily overloaded, the storage engine was non-performant, etc. People would come to me (as I was the &lt;em&gt;Project Team Leader&lt;/em&gt; at that time) and ask why the REST API would need 20 minutes to reply to an autoscaling request. The willingness to solve everything for everyone was killing Ceilometer. It&apos;s around that time that I decided to step out of my role of PTL and started working on Gnocchi to, at least, solve one of our biggest challenge: efficient data storage.&lt;/p&gt;
&lt;p&gt;Ceilometer was also suffering from the poor quality of many OpenStack projects. As Ceilometer retrieves data from a dozen of other projects, it has to use their interface for data retrieval (API calls, notifications) – or sometimes, palliate for their lack of any interface. Users were complaining about Ceilometer dysfunctioning while the root of the problem was actually on the other side, in the polled project. The polling agent would try to retrieve the list of virtual machines running on Nova, but just listing and retrieving this information required several HTTP requests to Nova. And those basic retrieval requests would overload the Nova API. The API does not offer any genuine interface from where the data could be retrieved in a small number of calls. And it had terrible performances.&lt;br /&gt;
From the point of the view of the users, the load was generated by Ceilometer. Therefore, Ceilometer &lt;strong&gt;was&lt;/strong&gt; the problem. We had to imagine new ways of circumventing tons of limitation from our siblings. That was exhausting.&lt;/p&gt;
&lt;p&gt;At its peak, during the Juno and Kilo releases (early 2015), the code size of Ceilometer reached 54k lines of code, and the number of committers reached 100 individuals (20 regulars). We had close to zero happy user, operators were hating us, and everybody was wondering what the hell was going in those developer minds.&lt;/p&gt;
&lt;p&gt;Nonetheless, despite the impediments, most of us had a great time working on Ceilometer. Nothing&apos;s ever perfect. I&apos;ve learned tons of things during that period, which were actually mostly non-technical. Community management, social interactions, human behavior and politics were at the heart of the adventure, offering a great opportunity for self-improvement.&lt;/p&gt;
&lt;p&gt;In the next blog post, I will cover what happened in the years that followed that booming period, up until today. Stay tuned!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>Scaling a polling Python application with tooz</title><link>https://julien.danjou.info/blog/scaling-a-python-application-tooz/</link><guid isPermaLink="true">https://julien.danjou.info/blog/scaling-a-python-application-tooz/</guid><description>This article is the final one of the series I wrote about scaling a large number of connections in a Python application. If you don&apos;t remember what the problem we&apos;re trying to solve is, here it is, co</description><pubDate>Mon, 05 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This article is the final one of the series I wrote about scaling a large number of connections in a Python application. If you don&apos;t remember what the problem we&apos;re trying to solve is, here it is, coming from one of my followers:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It so happened that I&apos;m currently working on scaling some Python app. Specifically, now I&apos;m trying to figure out the best way to scale SSH connections - when one server has to connect to thousands (or even tens of thousands) of remote machines in a short period of time (say, several minutes).&lt;br /&gt;
How would you write an application that does that in a scalable way?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The &lt;a href=&quot;https://julien.danjou.info/blog/scaling-python-application-threads&quot;&gt;first blog post&lt;/a&gt; was exploring a solution based on threads, while the &lt;a href=&quot;https://julien.danjou.info/blog/scaling-python-application-asyncio&quot;&gt;second blog post&lt;/a&gt; was exploring an architecture around &lt;em&gt;asyncio&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;In the two first articles, we wrote programs that could handle this problem by using multiple &lt;em&gt;threads&lt;/em&gt; or &lt;em&gt;asyncio&lt;/em&gt; – or both. While this worked pretty well, this had some limitations, such as only using one computer. So this time, we&apos;re going to take a different approach and use multiple computers!&lt;/p&gt;
&lt;h3&gt;The job&lt;/h3&gt;
&lt;p&gt;As we&apos;ve already seen, writing a Python application that connects to a host by ssh can be done using &lt;a href=&quot;http://docs.paramiko.org/en/&quot;&gt;Paramiko&lt;/a&gt; or &lt;a href=&quot;https://github.com/ronf/asyncssh&quot;&gt;asyncssh&lt;/a&gt; as we&apos;ve seen previously. Here again, that will not be the focus of this blog post since it is pretty straightforward to do.&lt;/p&gt;
&lt;p&gt;To keep this exercise simple, we&apos;ll reuse our &lt;code&gt;ping&lt;/code&gt; function from the first article. It looked like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import subprocess

def ping(hostname):
    p = subprocess.Popen([&quot;ping&quot;, &quot;-c&quot;, &quot;3&quot;, &quot;-w&quot;, &quot;1&quot;, hostname],
                         stdout=subprocess.DEVNULL,
                         stderr=subprocess.DEVNULL)
    return p.wait() == 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As a reminder, running this program alone and pinging serially 255 IP addresses takes more than 10 minutes. Let&apos;s try to make it faster by running it in parallel.&lt;/p&gt;
&lt;h3&gt;The architecture&lt;/h3&gt;
&lt;p&gt;Remember: if pinging 255 hosts takes 10 minutes, pinging the whole Internet is going to take forever – around five years at this rate.&lt;/p&gt;
&lt;p&gt;With our ping experiment, we already divided our mission (e.g. &quot;who&apos;s alive on the Internet&quot;) into very small tasks (&quot;ping&quot;). If we want to ping 4 billion hosts, we need to run those tasks in parallel. But one computer is not going to be enough: we need to distribute those tasks to different hosts, so we can use some massive parallelism to go even faster!&lt;/p&gt;
&lt;p&gt;There are two ways to distribute such a set of tasks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use a queue. That works well for jobs that are not determined in advance, such as user-submitted tasks or that are going to be executed only once.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use a distribution algorithm. That works only for tasks are determined in advance, and that are scheduled regularly, such as polling.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We are going to pick the second option here, as those ping tasks (or polling in the original problem) should regularly be run. That approach will allow us to spread the jobs onto several processes whose can be even spread onto several nodes over a network. We also won&apos;t have to &quot;maintain&quot; the queue (e.g. make it work and monitor it) so that&apos;s also a bonus point.&lt;/p&gt;
&lt;p&gt;That&apos;s infinite horizontal scalability!&lt;/p&gt;
&lt;h3&gt;The distribution algorithm&lt;/h3&gt;
&lt;p&gt;The algorithm we&apos;re going to use to distribute this task is based on a &lt;a href=&quot;https://en.wikipedia.org/wiki/Consistent_hashing&quot;&gt;consistent hashring&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here&apos;s how it works in short. Picture a circular ring. We map objects onto this ring. The ring is then split into partitions. Those partitions are distributed among all the workers. The workers take care of jobs that are in the partitions they are responsible for.&lt;/p&gt;
&lt;p&gt;In the case where a new node joins the ring, it is inserted between 2 nodes and take a bit of their workload. In the case where a node leaves the ring, the partitions it was taking care of are reassigned to its adjacent nodes.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/consistent-hashing.png&quot; alt=&quot;Diagram of consistent hashing ring with partitions distributed among worker nodes&quot; /&gt;&lt;/p&gt;
&lt;p&gt;If you want more details, it exists plenty of explanations about how this algorithm work. Feel free to look online!&lt;/p&gt;
&lt;p&gt;However, to make this work, we need to know which nodes are alive or dead. This is another problem to solve, and the best way to tackle it is to use a coordination mechanism. There are plenty of those, from &lt;a href=&quot;https://zookeeper.apache.org/&quot;&gt;Apache ZooKeeper&lt;/a&gt; to &lt;a href=&quot;https://coreos.com/etcd/&quot;&gt;etcd&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Without going too much into details, those pieces of software provide a network service where every node can connect to and can manage its state. If a client gets disconnected or crashes, it&apos;s then easy to consider it as removed. That enables the application to get the full list of nodes, and split the ring accordingly. There&apos;s no need to have any shared state between the nodes other than who&apos;s alive and running.&lt;/p&gt;
&lt;h3&gt;Using group membership&lt;/h3&gt;
&lt;p&gt;To get a list of nodes that are available to help us pinging the Internet, we need a service that provides this and a library to interact with it. Since the use case is pretty simple and I don&apos;t know which backends you like the most, we&apos;re going to use the &lt;a href=&quot;https://pypi.python.org/pypi/tooz&quot;&gt;Tooz&lt;/a&gt; library.&lt;/p&gt;
&lt;p&gt;Tooz provides a coordination mechanism on top of a large variety of backends: ZooKeeper or etcd, as suggested earlier, but also &lt;a href=&quot;https://redis.io&quot;&gt;Redis&lt;/a&gt; or &lt;a href=&quot;https://memcached.org&quot;&gt;memcached&lt;/a&gt; for those who want to live more dangerously. Indeed, while ZooKeeper or etcd can be set up in a synchronized cluster, memcached, on the other hand, is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Single_point_of_failure&quot;&gt;SPOF&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For the sake of the exercise, we&apos;re going to use a single instance of etcd here. Thanks to Tooz, switching to another backend would be a one-line change anyway.&lt;/p&gt;
&lt;p&gt;Tooz provides a &lt;code&gt;tooz.coordination.Coordinator&lt;/code&gt; object that represents the connection to the coordination subsystem. It then exposes an API based on groups and members. A member is a node connected through a &lt;code&gt;Coordinator&lt;/code&gt; instance. A group is a place that members can join or leave.&lt;/p&gt;
&lt;p&gt;Here&apos;s a first implementation of a member joining a group and printing the member list:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import sys
import time

from tooz import coordination

## Check that a client and group ids are passed as arguments
if len(sys.argv) != 3:
    print(&quot;Usage: %s &amp;lt;client id&amp;gt; &amp;lt;group id&amp;gt;&quot; % sys.argv[0])
    sys.exit(1)

## Get the Coordinator object
c = coordination.get_coordinator(
    &quot;etcd3://localhost&quot;,
    sys.argv[1].encode())
## Start it (initiate connection).
c.start(start_heart=True)

group = sys.argv[2].encode()

## Create the group
try:
    c.create_group(group).get()
except coordination.GroupAlreadyExist:
    pass

## Join the group
c.join_group(group).get()

try:
    while True:
        # Print the members list
        members = c.get_members(group)
        print(members.get())
        time.sleep(1)
finally:
    # Leave the group
    c.leave_group(group).get()

    # Stop when we&apos;re done
    c.stop()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Don&apos;t forget to run etcd on your machine before running this program. Running a first instance of this program will print &lt;code&gt;set([&apos;client1&apos;])&lt;/code&gt; every second. As soon as you run a second instance of this program, they both start to print &lt;code&gt;set([&apos;client1&apos;, &apos;client2&apos;])&lt;/code&gt;. If you shut down one of the clients, they will print the member list with only one member of it.&lt;/p&gt;
&lt;p&gt;This can work with any number of client. If a client crashes rather than disconnect properly, its membership will automatically expire a few seconds – you can configure this expiration period with by passing a &lt;code&gt;timeout&lt;/code&gt; value in&lt;br /&gt;
Tooz URL.&lt;/p&gt;
&lt;h3&gt;Using consistent hashing&lt;/h3&gt;
&lt;p&gt;Now that we have a group, which will turn out to be our &lt;em&gt;ring&lt;/em&gt;, we can&lt;br /&gt;
implement consistent hashring on top of it. Fortunately, Tooz also provides an implementation of this that is ready to be used. Rather than using the&lt;br /&gt;
&lt;code&gt;join_group&lt;/code&gt; method, we&apos;re gonna use the &lt;code&gt;join_partitioned_group&lt;/code&gt; method.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import sys
import time

from tooz import coordination

## Check that a client and group ids are passed as arguments
if len(sys.argv) != 3:
    print(&quot;Usage: %s &amp;lt;client id&amp;gt; &amp;lt;group id&amp;gt;&quot; % sys.argv[0])
    sys.exit(1)

## Get the Coordinator object
c = coordination.get_coordinator(
    &quot;etcd3://localhost&quot;,
    sys.argv[1].encode())
## Start it (initiate connection).
c.start(start_heart=True)

group = sys.argv[2].encode()

## Join the partitioned group
p = c.join_partitioned_group(group)

try:
    while True:
        print(p.members_for_object(&quot;foobar&quot;))
        time.sleep(1)
finally:
    # Leave the group
    c.leave_group(group).get()

    # Stop when we&apos;re done
    c.stop()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Running this program on one node (or just one terminal) will output the following every second:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ python distribution.py client1 foobar
0 handled by set([&apos;client1&apos;])
1 handled by set([&apos;client1&apos;])
2 handled by set([&apos;client1&apos;])
3 handled by set([&apos;client1&apos;])
4 handled by set([&apos;client1&apos;])
5 handled by set([&apos;client1&apos;])
6 handled by set([&apos;client1&apos;])
7 handled by set([&apos;client1&apos;])
8 handled by set([&apos;client1&apos;])
9 handled by set([&apos;client1&apos;])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As soon as a second members join (just run another copy of the script in another terminal), the output changes and both the running programs output the same thing:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0 handled by set([&apos;client2&apos;])
1 handled by set([&apos;client1&apos;])
2 handled by set([&apos;client1&apos;])
3 handled by set([&apos;client1&apos;])
4 handled by set([&apos;client1&apos;])
5 handled by set([&apos;client2&apos;])
6 handled by set([&apos;client2&apos;])
7 handled by set([&apos;client1&apos;])
8 handled by set([&apos;client1&apos;])
9 handled by set([&apos;client2&apos;])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;They just shared the ten objects between them. They &lt;strong&gt;did not communicate with each other&lt;/strong&gt;. They just know each other presence, and since they are using the same algorithm to compute where an object should belong, they share the same&lt;br /&gt;
results. You can do the test with a third copy of the program:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0 handled by set([&apos;client2&apos;])
1 handled by set([&apos;client1&apos;])
2 handled by set([&apos;client1&apos;])
3 handled by set([&apos;client1&apos;])
4 handled by set([&apos;client1&apos;])
5 handled by set([&apos;client2&apos;])
6 handled by set([&apos;client2&apos;])
7 handled by set([&apos;client3&apos;])
8 handled by set([&apos;client1&apos;])
9 handled by set([&apos;client3&apos;])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here we got a third client in the mix, excellent! If we stop one of the clients, the rebalancing is done automatically.&lt;/p&gt;
&lt;p&gt;While the consistent hashing approach is great, is has a few characteristics you might want to know about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The distribution algorithm is not made to be perfectly even. If you have a vast number of objects, it might seem pretty even statistically, but if you are trying to distribute two objects on two nodes, it&apos;s probable one node will handle the two objects and the other one none.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The distribution is not done in real time, meaning there&apos;s a small chance that an object might be owned by two nodes at the same time. This is not a problem in a scenario such as this one, since pinging a host twice is not going to be a big deal, but if your job needed to be unique and executed once and only once, this might not be an adequate method of distribution. Rather use a queue which has the proper characteristics.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Distributed ping&lt;/h3&gt;
&lt;p&gt;Now that we have our hashring ready to distribute our job, we can implement our final program!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import sys
import subprocess
import time

from tooz import coordination

## Check that a client and group ids are passed as arguments
if len(sys.argv) != 3:
    print(&quot;Usage: %s &amp;lt;client id&amp;gt; &amp;lt;group id&amp;gt;&quot; % sys.argv[0])
    sys.exit(1)

## Get the Coordinator object
c = coordination.get_coordinator(
    &quot;etcd3://localhost&quot;,
    sys.argv[1].encode())
## Start it (initiate connection).
c.start(start_heart=True)

group = sys.argv[2].encode()

## Join the partitioned group
p = c.join_partitioned_group(group)

class Host(object):
    def __init__(self, hostname):
        self.hostname = hostname

    def __tooz_hash__(self):
        &quot;&quot;&quot;Returns a unique byte identifier so Tooz can distribute this object.&quot;&quot;&quot;
        return self.hostname.encode()

    def __str__(self):
        return &quot;&amp;lt;%s: %s&amp;gt;&quot; % (self.__class__.__name__, self.hostname)

    def ping(self):
        p = subprocess.Popen([&quot;ping&quot;, &quot;-q&quot;, &quot;-c&quot;, &quot;3&quot;, &quot;-W&quot;, &quot;1&quot;,
                              self.hostname],
                             stdout=subprocess.DEVNULL,
                             stderr=subprocess.DEVNULL)
        return p.wait() == 0

hosts_to_ping = [Host(&quot;192.168.2.%d&quot; % i) for i in range(255)]

try:
    while True:
        for host in hosts_to_ping:
            c.run_watchers()
            if p.belongs_to_self(host):
                print(&quot;Pinging %s&quot; % host)
                if host.ping():
                    print(&quot;  %s is alive&quot; % host)
        time.sleep(1)
finally:
    # Leave the group
    c.leave_group(group).get()

    # Stop when we&apos;re done
    c.stop()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When the first client starts, it starts iterating on the host, and since it is alone, all hosts belong to it. So it starts pinging all nodes:&lt;/p&gt;
&lt;p&gt;{% syntax %}&lt;br /&gt;
$ python3 ping.py client1 ping&lt;br /&gt;
Pinging &amp;lt;Host: 192.168.2.0&amp;gt;&lt;br /&gt;
&amp;lt;Host: 192.168.2.0&amp;gt; is alive&lt;br /&gt;
Pinging &amp;lt;Host: 192.168.2.1&amp;gt;&lt;br /&gt;
&amp;lt;Host: 192.168.2.1&amp;gt; is alive&lt;br /&gt;
Pinging &amp;lt;Host: 192.168.2.2&amp;gt;&lt;br /&gt;
{% endsyntax %}&lt;/p&gt;
&lt;p&gt;Then, a second client starts pinging too, and automatically the jobs are split. The &lt;code&gt;client1&lt;/code&gt; instance starts skipping some nodes that now belongs to &lt;code&gt;client2&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;## client1 output
Pinging &amp;lt;Host: 192.168.2.8&amp;gt;
  &amp;lt;Host: 192.168.2.8&amp;gt; is alive
Pinging &amp;lt;Host: 192.168.2.9&amp;gt;
Pinging &amp;lt;Host: 192.168.2.11&amp;gt;
Pinging &amp;lt;Host: 192.168.2.12&amp;gt;

## client2 output
Pinging &amp;lt;Host: 192.168.2.7&amp;gt;
Pinging &amp;lt;Host: 192.168.2.10&amp;gt;
Pinging &amp;lt;Host: 192.168.2.13&amp;gt;
  &amp;lt;Host: 192.168.2.13&amp;gt; is alive
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the other hand, &lt;code&gt;client2&lt;/code&gt; is skipping nodes that are belonging to &lt;code&gt;client1&lt;/code&gt;. If you want to scale further our application, we can start new clients on other nodes on the network and expand our pinging system!&lt;/p&gt;
&lt;h3&gt;Just a first step&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://scaling-python.com&quot;&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/the-hacker-guide-to-scaling-python.png&quot; alt=&quot;Cover of The Hacker&apos;s Guide to Scaling Python&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This &lt;code&gt;ping&lt;/code&gt; job does not use a lot of CPU time or I/O bandwidth, neither would the original ssh case by Alon. However, if that would be the case, this method would be even more efficient as the scalability of the resources would be a key.&lt;/p&gt;
&lt;p&gt;These are just the first steps of the distribution and scalability mechanism&lt;br /&gt;
that you can implement using Python. There are a few other options available on top of this mechanism such as defining different weights for different nodes or using replicas to achieve high-availability scenario. I&apos;ve covered those in my book &lt;a href=&quot;https://scaling-python.com&quot;&gt;Scaling Python&lt;/a&gt;, if you&apos;re interested in learning more!&lt;/p&gt;
</content:encoded><category>python</category><category>openstack</category></item><item><title>My interview with Cool Python Codes</title><link>https://julien.danjou.info/blog/interview-coolpythoncodes/</link><guid isPermaLink="true">https://julien.danjou.info/blog/interview-coolpythoncodes/</guid><description>A few days ago, I&apos;ve recently been contacted by Godson Rapture from Cool Python codes to answer a few questions about what I work on in open source.</description><pubDate>Thu, 05 Oct 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A few days ago, I&apos;ve recently been contacted by Godson Rapture from &lt;a href=&quot;http://coolpythoncodes.com/&quot;&gt;Cool Python codes&lt;/a&gt; to answer a few questions about what I work on in open source. Godson regularly interview developers and I invite you to check out his website!&lt;/p&gt;
&lt;p&gt;Here&apos;s a copy of &lt;a href=&quot;http://coolpythoncodes.com/julien-danjou/&quot;&gt;my original interview&lt;/a&gt;. Enjoy!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Good day, Julien Danjou, welcome to Cool Python Codes. Thanks for taking your precious time to be here.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You’re welcome!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Could you kindly tell us about yourself like your full name, hobbies, nationality, education, and experience in programming?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Sure. I’m Julien Danjou, I’m French and live in Paris, France. I studied Computer science for 5 years around 15 years ago, and continued my career in that field since then, specializing in open source projects.&lt;/p&gt;
&lt;p&gt;Those last years, I’ve been working as a software engineer at Red Hat. I’ve spent the last 10 years working with the Python programming language. Now I work on the Gnocchi project which is a time series database.&lt;/p&gt;
&lt;p&gt;When I’m not coding, I enjoy running half-marathon and playing FPS games.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/pyconfr-2017-jd.jpg&quot; alt=&quot;Julien Danjou at PyCon France 2017&quot; /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Can you narrate your first programming experience and what got you to start learning to program?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I started programming around 2001, and my first serious programs were in Perl. I was contributing to a hosting platform for free software named VHFFS. It was a free software project itself, and I enjoyed being able to learn from other more experienced developers and being able to contribute back to it. That’s what got me stuck into that world of open source projects.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Which programming language do you know and which is your favorite?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I know quite a few, I’ve been doing serious programming in Perl, C, Lua, Common Lisp, Emacs Lisp and Python.&lt;/p&gt;
&lt;p&gt;Obviously, my favorite is Common Lisp, but I was never able to use it for any serious project, for various reasons. So I spend most of my time hacking with Python, which I really enjoy as it is close to Lisp, in some ways. I see it as a small subset of Lisp.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;What inspired you to venture into the world of programming and drove you to learn a handful of programming languages?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It was mostly scratching my own itches when I started. Each time I saw something I wanted to do or a feature I wanted in an existing software, I learned what I needed to get going and get it working.&lt;/p&gt;
&lt;p&gt;I studied C and Lua while writing awesome- the window manager that I created 10 years ago and used for a while. I learned Emacs Lisp while writing extensions that I wanted to see in Emacs, etc. It’s the best way to start.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;What is your blog about?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;My blog is a platform where I write about what I work on most of the time. Nowadays, it’s mostly about Python and the main project I contribute to,&lt;br /&gt;
Gnocchi.&lt;/p&gt;
&lt;p&gt;When writing about Gnocchi, I usually try to explain what part of the project I worked on, what new features we achieved, etc.&lt;/p&gt;
&lt;p&gt;On Python, I try to share solutions to common problems I encountered or identified while doing e.g. code reviews. Or presenting a new library I created!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Tell us more about your book, The Hacker’s Guide to Python.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It’s a compilation of everything I learned those last years building large Python applications. I spent the last 6 years developing on a large code base with thousands of other developers.&lt;/p&gt;
&lt;p&gt;I’ve reviewed tons of code and identified the biggest issues, mistakes, and bad practice that developers tend to have. I decided to compile that in a guide, helping developers that played a bit with Python to learn the stages to get really productive with Python.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;OpenStack is the biggest open source project in Python, Can you tell us more about OpenStack?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;OpenStack is a cloud computing platform, started 7 years ago now. Its goal is to provide a programmatic platform to manage your infrastructure while being open source and avoiding vendor lock-in.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Who uses OpenStack? Is it for programmers, website owners?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It’s used by a lot of different organizations – not really by individuals. It’s a big piece of software. You can find it in some famous public cloud providers (Dreamhost, Rackspace…), and also as a private cloud in a lot of different organizations, from Bloomberg to eBay or the CERN in Switzerland, a big OpenStack user. Tons of telecom providers also leverages OpenStack for their own internal infrastructure.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Have you participated in any OpenStack conference? What did you speak on if&lt;br /&gt;
you did?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I’ve attended the last 9 OpenStack summits and a few other OpenStack events around the world. I’ve been engaged in the upstream community for the last 6 years now.&lt;/p&gt;
&lt;p&gt;My area of expertise is telemetry, the stack of software that is in charge of collecting and storing metrics from the various OpenStack components. This is what I regularly talk about during those events.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;How can one join the OpenStack community?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There’s an entire documentation about that, called the &lt;a href=&quot;https://docs.openstack.org/infra/manual/developers.html&quot;&gt;Developer’s Guide&lt;/a&gt;. It explains how to setup your environment to send patches, how to join the community using the mailing-lists or IRC.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;What makes your book, &lt;a href=&quot;https://thehackerguidetopython.com&quot;&gt;The Hacker’s Guide to Python&lt;/a&gt; stand out from other Python books? Also, who exactly did you write this book for?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I wrote the book that I always wanted to read about Python, but never found. It’s not a book for people that want to learn Python from scratch. It’s a great guide for those who know the language but don’t know the details that experienced developers know and that make the difference. The best practice, the elegant solutions to common problems, etc. That’s why it also includes interviews with prominent Python developers, so they can share their advice on different areas.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;How can someone get your book?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I’ve decided to self-publish my book, so he does not have an editor like you can be used to see. The best place to get it is online at where you can pick the format you want, electronic or paper.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;What do you mean when you say you hack with Python?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Unfortunately, most people refer to hacking as the activity of some bad guys trying to get access to whatever they’re not supposed to see. In the book title, I mean “hacking” as the elegant way of writing code and making things worse smoothly even when you were not expecting to make it.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;You mentioned earlier that Gnocchi is a time series database. Can you please be more elaborate about Gnocchi? Is there also any documentation about Gnocchi?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So Gnocchi is a project I started a few years ago to store time series at large scale. Timeseries are basically a series of tuple composed of a timestamp and a value.&lt;/p&gt;
&lt;p&gt;Imagine you wanted to store the temperature of all the rooms of the world at any point of time. You’d need a dedicated database for that with the right data structure. This is what Gnocchi does: it provides this data structure storage at very, very large scale.&lt;/p&gt;
&lt;p&gt;The primary use case is infrastructure monitoring, so most people use it to store tons of metrics about their hardware, software, etc. It’s fully documented on &lt;a href=&quot;http://gnocchi.xyz&quot;&gt;its website&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;How can a programmer without much experience contribute to open source projects?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The best way to start is to try to fix something that irritates you in some way. It might be a bug, it might be a missing feature. Start small. Don’t try big things first or you could be discouraged.&lt;/p&gt;
&lt;p&gt;Never stop.&lt;/p&gt;
&lt;p&gt;Also, don’t plunge right away in the community and start poking random people or spam them with questions. Do your homework, and listen to the community for a while to get a sense of how things are going. That can be joining IRC and lurking or following the mailing lists for example.&lt;/p&gt;
&lt;p&gt;Big open source communities dedicate programs to help you become engaged. It might be worth a try. Generic programs like Outreachy or Google Summer of Code are a great way to start if you don’t feel confident enough to jump by your own means in a community.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Just out of curiosity, do you write code in French?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Never ever. I think it’s acceptable to write in your language if you are sure that your code will never be open sourced and that your whole team is talking in that language, no matter what – but it’s a ballsy assumption, clearly.&lt;/p&gt;
&lt;p&gt;Truth is that if you do open source, English is the standard, so go with it. Be sad if you want, but please be pragmatic.&lt;/p&gt;
&lt;p&gt;I’ve seen projects being open sourced by companies where all the code source comments were in Korean. It was impossible for any non-Korean people to get a glance of what the code and the project was doing, so it just failed and disappeared.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;How does a team of programmers handle bugs in a large open source project?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I wish there was some magic recipe, but I don’t think it’s the case. What you want is to have a place where your users can feel safe reporting bugs. Include a template so they don’t forget any details: how to reproduce the bugs, what they expected, etc. The worst thing is to have users reporting “That does not work.” with no details. It’s a waste of time.&lt;/p&gt;
&lt;p&gt;What tool to use to log all of that really depends on the team size and culture.&lt;/p&gt;
&lt;p&gt;Once that works, the actual fixing of bug doesn’t follow any rule. Most developers fix the bug they encounter or the ones that are the most critical for users. Smaller problems might not be fixed for a long time.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Can you tell us about the new book you are working on and when do we expect&lt;br /&gt;
to get it?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That new book is entitled &lt;a href=&quot;https://scaling-python.com&quot;&gt;“Scaling Python”&lt;/a&gt; and it provides insight into how to build largely scalable and distributed applications using Python.&lt;/p&gt;
&lt;p&gt;It is also based on my experience in building this kind of software during the past years. This book also includes interviews of great Python hackers who work on scalable system or know a thing or two about writing applications for performance – an important point to have scalable applications.&lt;/p&gt;
&lt;p&gt;The book is in its final stage now, and it should be out at the beginning of 2018.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;How can someone get in contact with you?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I’m reachable at &lt;a href=&quot;mailto:julien@danjou.info&quot;&gt;julien@danjou.info&lt;/a&gt; by email or via Twitter, &lt;a href=&quot;https://twitter.com/juldanjou&quot;&gt;@juldanjou&lt;/a&gt;.&lt;/p&gt;
</content:encoded><category>career</category><category>python</category><category>books</category><category>gnocchi</category><category>openstack</category></item><item><title>OpenStack Summit Boston 2017 recap</title><link>https://julien.danjou.info/blog/openstack-summit-pike-boston-recap/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-summit-pike-boston-recap/</guid><description>The first OpenStack Summit of 2017 was last week, in Boston, MA, USA. I was able to attend as I&apos;ve been selected to give 3 talks, to help for a hands-on and to animate an on-boarding session.</description><pubDate>Mon, 15 May 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The &lt;a href=&quot;https://www.openstack.org/summit/boston-2017/&quot;&gt;first OpenStack Summit of 2017&lt;/a&gt; was last week, in Boston, MA, USA. I was able to attend as I&apos;ve been selected to give 3 talks, to help for a hands-on and to animate an on-boarding session. This made sure I was a bit busy every day, which was good.&lt;/p&gt;
&lt;p&gt;This is the first summit to happen since the new &lt;a href=&quot;https://www.openstack.org/ptg/&quot;&gt;Project Team Gathering (PTG)&lt;/a&gt; happened last February. I was unable to attend this first PTG back then, as there was no way to justify my presence there. The OpenStack Telemetry team that I lead is pretty small. People don&apos;t really need to talk to each other face to face to discuss: therefore we decided to not ask to be present during the last PTG event.&lt;/p&gt;
&lt;p&gt;The Telemetry on-boarding session that I organized with my fellow developer Gordon Chung on Tuesday had only 3 people showing up to ask a few questions about Telemetry. The session lasted 15 minutes on 90 planned. We shared that session with &lt;a href=&quot;https://wiki.openstack.org/wiki/CloudKitty&quot;&gt;CloudKitty&lt;/a&gt;, for which nobody showed up for. When you think about it, this was really disappointing but did not come as a surprise.&lt;/p&gt;
&lt;p&gt;First, the amount of company engaging developers into OpenStack has shrunk drastically during the last year. Secondly, since there&apos;s now another event (the PTG) twice a year, it seems pretty clear that every developer will not be able to attend all the 4 events every year, creating dispersion in the community.&lt;/p&gt;
&lt;p&gt;I personally was glad to attend the Summit rather than the PTG, as it is more valuable to meet operators and users than developers to gather feedback. However, meeting everyone at the same time would be great, especially for smaller teams. The PTG scattered some teams to a point that many of developers of those lineups won&apos;t go to either the PTG nor the OpenStack. As a consequence, I won&apos;t have any meeting point in the future with many of my fellow developers around OpenStack. I warned the Technical Committee last year about this when it was decided to reorganize the events. I&apos;m glad to be right but I&apos;m a bit sad that the Foundation did not listen.&lt;/p&gt;
&lt;p&gt;Though all the projects I work on tend to follow &lt;a href=&quot;https://julien.danjou.info/blog/foss-projects-management-bad-practice&quot;&gt;the good practice I wrote last year&lt;/a&gt;. Therefore I cannot say that it has huge consequences on the projects I work on. It&apos;s a loss as it makes it harder to reach users and operators for some of us. It also reduces our occasion for social interaction, which was a great benefit. But it will not prevent us from building great software anyway!&lt;/p&gt;
&lt;p&gt;The few other sessions of &lt;em&gt;&lt;a href=&quot;https://wiki.openstack.org/wiki/Forum&quot;&gt;The Forum&lt;/a&gt;&lt;/em&gt; (the space dedicated to developers during the Summit) that I attended discussed various technical things, and some sessions were pretty empty. I wonder if it was a lack of interest of people or if people were unable to travel to discuss those items. Anyhow, at this stage I am not sure it would have really mattered: this has been my 9th OpenStack Summit and many of the subjects discussed already have been discussed multiple time with barely any change since. Talk is cheap. Furthermore, most of the discussion were not made by stakeholders of the various projects involved, but by people on the side, or by members of the Technical Committee. There is just unfortunately too much of wishful thinking.&lt;/p&gt;
&lt;p&gt;On the talk side, my presentation with Alex Krzos entitled &lt;em&gt;Telemetry and the 10,000 instances&lt;/em&gt; went pretty well. We demonstrated what how we tested the performance of the telemetry stack.&lt;/p&gt;
&lt;p&gt;Same goes for my hands-on with the CloudKitty developers, where we managed to explain how Ceilometer, Gnocchi, and CloudKitty were able to work with each other to create nice billing reports. The last day was concluded with my talk on collectd and Gnocchi with Emma, which was short and to the point.&lt;/p&gt;
&lt;p&gt;My final talk was about the status and roadmap of the OpenStack Telemetry team where I tried to explain how the Telemetry works and what we might do (or not) in the next cycles. It was pretty short as we barely have a roadmap, the project having 3 developers doing 80% of the work.&lt;/p&gt;
&lt;p&gt;I was also able to catch up with Nubeliu about their Gnocchi usage. They &lt;a href=&quot;https://www.youtube.com/watch?v=Hlt3UwsvgjU&quot;&gt;presented a nice demo of the cloud monitoring solution&lt;/a&gt; they build on top of Gnocchi. They completely understood how to use Gnocchi to store a large number of metrics at scale and how to leverage the API to render what&apos;s happening in your infrastructure. It is pretty amazing.&lt;/p&gt;
&lt;p&gt;While I missed the energy and the drive that the design session used to have in the first summits, it has been a pretty good summit. I was especially happy to be able to discuss OpenStack Telemetry and Gnocchi. The feedback I gathered was tremendous and terrific and I&apos;m looking forward to the work we&apos;ll achieve in the next months!&lt;/p&gt;
</content:encoded><category>openstack</category><category>gnocchi</category><category>talks</category></item><item><title>Gnocchi independence</title><link>https://julien.danjou.info/blog/gnocchi-independence/</link><guid isPermaLink="true">https://julien.danjou.info/blog/gnocchi-independence/</guid><description>Three years have passed since Gnocchi started. After being incubated inside OpenStack, the project is now going independent.</description><pubDate>Sat, 06 May 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Three years have passed since I started working on &lt;a href=&quot;http://gnocchi.xyz&quot;&gt;Gnocchi&lt;/a&gt;. It&apos;s amazing to gaze at the path we wandered on.&lt;/p&gt;
&lt;p&gt;During all this time, Gnocchi has been &quot;incubated&quot; inside OpenStack. It has been created there and it grew with the rest of the ecosystem. But Gnocchi (developers) always stuck to some strange principles: autonomy and independence from the other OpenStack projects. This actually made the project a bit unpopular sometimes inside OpenStack, being stamped as some kind of &lt;em&gt;rebel&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I&apos;ve spent the last years asserting that each project inside OpenStack should seek towards living its own life. It is a key success for any open source project to be able to be used in any context, not only the one it has been built for. Having to use large bundles of projects together is not a good user story. I wish OpenStack will be a set of more autonomous building blocks.&lt;/p&gt;
&lt;p&gt;One of the most used project by people not using an entire OpenStack installation has been &lt;a href=&quot;https://launchpad.net/swift&quot;&gt;Swift&lt;/a&gt;. That was possible because Swift always tried to be autonomous and to not depend on any other service. It is able to leverage external services but it can also work without any. And I feel that Swift is the most successful project if you measure that success by being used by people having zero knowledge about OpenStack.&lt;/p&gt;
&lt;p&gt;With the move toward the &lt;em&gt;Big Tent&lt;/em&gt;, it struck me that the OpenStack Foundation will end up as some sort of an Apache Foundation. And I am pretty sure nobody forces you to use the &lt;a href=&quot;https://httpd.apache.org/&quot;&gt;Apache HTTP server&lt;/a&gt; if you want to use e.g. &lt;a href=&quot;http://lucene.apache.org/&quot;&gt;Lucene&lt;/a&gt; or &lt;a href=&quot;http://hbase.apache.org/&quot;&gt;HBase&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Being part of OpenStack for Gnocchi has been a great advantage at the beginning of the project. The infrastructure provided is awesome. The support we had from the community was great. The Gerrit workflow suited us well.&lt;/p&gt;
&lt;p&gt;But unfortunately, now that the project is getting more and more mature, many of the requirements of being an OpenStack project has become a real burden. The various processes forced by OpenStack is hurting the development pace. The contribution workflow based around Gerrit and &lt;a href=&quot;https://launchpad.net&quot;&gt;Launchpad&lt;/a&gt; is too complicated for most external contributors and therefore prevents new users to participate to the development.&lt;br /&gt;
Worse, the bad image or reputation that OpenStack carries in certain situation or communities is preventing Gnocchi to be evaluated and, maybe, used.&lt;/p&gt;
&lt;p&gt;I think that many of those negative aspects are finally taken into account by the OpenStack Technical Committee, as can be seen in the &lt;a href=&quot;https://review.openstack.org/#/c/453262/&quot;&gt;proposed vision of 2 years from now for OpenStack&lt;/a&gt;.&lt;br /&gt;
Better late than never.&lt;/p&gt;
&lt;p&gt;So after spending a lot of time weighing the pros and the cons, we, Gnocchi&lt;br /&gt;
contributors, &lt;a href=&quot;http://lists.openstack.org/pipermail/openstack-dev/2017-March/114300.html&quot;&gt;finally decided to move Gnocchi out of OpenStack&lt;/a&gt;.&lt;br /&gt;
We started to move the project to a brand new &lt;a href=&quot;https://github.com/gnocchixyz&quot;&gt;Gnocchi organization on GitHub&lt;/a&gt;. At the time of this writing, only the main gnocchi repository is missing and should be moved soon after the OpenStack Summit happening next week.&lt;/p&gt;
&lt;p&gt;We also used that opportunity to make usage of the new Gnocchi logo, courtesy of my friend Thierry Ung!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi-logo.png&quot; alt=&quot;Gnocchi logo&quot; /&gt;&lt;/p&gt;
&lt;p&gt;We&apos;ll see how everything will turn out and if the project will gain more traction, as we hope. This will not change the consumption of Gnocchi made by projects such as &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt;. and the project aims to remain a good friend of OpenStack. 😀&lt;/p&gt;
</content:encoded><category>gnocchi</category><category>openstack</category></item><item><title>Attending OpenStack Summit Ocata</title><link>https://julien.danjou.info/blog/openstack-summit-ocata-barcelona-review/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-summit-ocata-barcelona-review/</guid><description>For the last time in 2016, I flew out to the OpenStack Summit in Barcelona, where I had the chance to meet (again) a lot of my fellow OpenStack contributors there.</description><pubDate>Mon, 31 Oct 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;For the last time in 2016, I flew out to the &lt;a href=&quot;https://www.openstack.org/summit/barcelona-2016/&quot;&gt;OpenStack Summit in Barcelona&lt;/a&gt;, where I had the chance to meet (again) a lot of my fellow OpenStack contributors there.&lt;/p&gt;
&lt;h2&gt;How To Work Upstream with OpenStack&lt;/h2&gt;
&lt;p&gt;My week started by giving a talk about &lt;em&gt;How To Work Upstream with OpenStack&lt;/em&gt; where I explained, accompanied by Ryota and Ashiq, to the audience how to contribute upstream to OpenStack. It went well and was well received by the public – you can watch the video below or&lt;br /&gt;
download the slides.&lt;/p&gt;
&lt;h2&gt;Python 3 in telemetry projects&lt;/h2&gt;
&lt;p&gt;I&apos;ve attended a few interesting cross-project sessions, which helped me getting some prioritization for my work during the next few months.&lt;/p&gt;
&lt;p&gt;The Python 3 porting effort is blocked for a while in Nova and Swift for various (mostly non-technical) reasons, while almost all other projects are working correctly. On the other hand, we have committed the telemetry projects to be the first one to drop Python 2 support has soon as it is possible. The next steps are to be sure downstream is ready and enable functional testing in devstack with Python 3.&lt;/p&gt;
&lt;h2&gt;Ceilometer deprecation&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gordon-gnocchi-talk.jpg&quot; alt=&quot;gordon-gnocchi-talk&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The Ceilometer sessions were really interesting, are we mainly discussed deprecating and removing old crufts that are not or should not be used anymore. The main change will be the depreciation of the Ceilometer API. It has been clear for more than a year that &lt;a href=&quot;http://gnocchi.xyz&quot;&gt;Gnocchi&lt;/a&gt; is the way-to-go to store and provide access to metrics, but we failed at announcing wildly. A lot of the people I talked to during the summit were not aware that the Ceilometer API was not a good pick, and that Gnocchi was the now recommended storage backend. Bad communication from our side – but we are going to fix it as of now.&lt;/p&gt;
&lt;p&gt;We also committed to simplify the current architecture by removing the collector, which has now be made obsolete by the agent based architecture that was implemented during the last development cycles.&lt;/p&gt;
&lt;h2&gt;Aodh alarm timeout&lt;/h2&gt;
&lt;p&gt;We had a feature proposal for a while in Aodh that we postponed for too long already: having timeout triggered after not having seen some events. This seems to be a functionality requested by NFV users – something we want Aodh to cover.&lt;/p&gt;
&lt;p&gt;We spent some time discussing this feature, and now that we all have a clear understanding of the use case, we&apos;ll work on having a clear path to the implementation.&lt;/p&gt;
&lt;p&gt;I&apos;ve also attended a session with the &lt;a href=&quot;https://wiki.openstack.org/wiki/Vitrage&quot;&gt;Vitrage&lt;/a&gt; developers in order to discuss how we could work better together, as they rely on Aodh. It seems there might be some convergence in the future, which would be very welcome. Wait&apos;n see.&lt;/p&gt;
&lt;h2&gt;Gnocchi improvement, past and future&lt;/h2&gt;
&lt;p&gt;The Gnocchi session ran smoothly, and everyone seemed happy with the work we have done so far. We&apos;ve made some impressive improvement in Gnocchi 3.0 – as &lt;a href=&quot;https://julien.danjou.info/blog/2016/gnocchi-3.0-release&quot;&gt;I already covered previously&lt;/a&gt; – and Gordon Chung presented a short talk about the performance difference metered while working on this new version of Gnocchi:&lt;/p&gt;
&lt;p&gt;The return of the InfluxDB driver is on the table, as Sam Morrison proposed a patch for that while back. While it&apos;s not as fast and scalable as other drivers, it offers a good alternative for people having to use it.&lt;/p&gt;
&lt;p&gt;Leandro Reox presented how to do capacity planning using Ceilometer and Gnocchi, presenting the projects at the same time:&lt;/p&gt;
&lt;p&gt;It is pretty impressive to see what they achieved with this project, and I&apos;m looking forward to being able to check how it works inside.&lt;/p&gt;
&lt;h2&gt;PTG and beyond&lt;/h2&gt;
&lt;p&gt;The next meeting is supposed to be the new &lt;a href=&quot;https://www.openstack.org/ptg/&quot;&gt;OpenStack PTG&lt;/a&gt; in February in Atlanta, though we did not request any specific space there. While the team love seeing each other face-to-face every few months, we achieved to follow &lt;a href=&quot;https://julien.danjou.info/blog/foss-projects-management-bad-practice&quot;&gt;all of the guidelines I listed recently&lt;/a&gt; on good open source project management, meaning we are able to work very well asynchronously and remotely. There is no need to put hard requirements on people wanting to participate in our community. Nevertheless, I expect cross-projects discussions that will happen to still concern the OpenStack Telemetry projects.&lt;/p&gt;
&lt;p&gt;In the end, we&apos;re all very happy with our past and future roadmaps and I&apos;m looking forward to achieving our next big milestones with our amazing telemetry team!&lt;/p&gt;
</content:encoded><category>openstack</category><category>gnocchi</category><category>open-source</category><category>talks</category></item><item><title>Gnocchi 3.0 release</title><link>https://julien.danjou.info/blog/gnocchi-3-0-release/</link><guid isPermaLink="true">https://julien.danjou.info/blog/gnocchi-3-0-release/</guid><description>After a few weeks of hard work with the team, here is the new major version of Gnocchi, stamped 3.0.0. It was very challenging, as we wanted to implement a few big changes in it.</description><pubDate>Mon, 03 Oct 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;After a few weeks of hard work with the team, here is the new major version of Gnocchi, stamped &lt;a href=&quot;https://launchpad.net/gnocchi/3.0/3.0.0&quot;&gt;3.0.0&lt;/a&gt;. It was very challenging, as we wanted to implement a few big changes in it.&lt;/p&gt;
&lt;p&gt;Gnocchi is now using &lt;a href=&quot;http://docs.openstack.org/developer/reno/&quot;&gt;reno&lt;/a&gt; to its maximum and you can read &lt;a href=&quot;http://gnocchi.xyz/releasenotes/3.0.html&quot;&gt;the release notes of the 3.0 branch&lt;/a&gt; online. Some notes might be missing as it is our first release with it, but we are making good progress at writing changelogs for most of our user facing and impacting changes.&lt;/p&gt;
&lt;p&gt;Therefore, I&apos;ll only write here about our big major feature that made us bump the major version number.&lt;/p&gt;
&lt;h2&gt;New storage engine&lt;/h2&gt;
&lt;p&gt;And so the most interesting thing that went in the 3.0 release, is the new storage engine that has been built by me and Gordon Chung during those last months. The original approach of writing data in Gnocchi was really naive, so we had an iterative improvement process since version 1.0, and we&apos;re getting close to something very solid.&lt;/p&gt;
&lt;p&gt;This new version leverages several important features which increase performance by a large factor on Ceph (using &lt;code&gt;write(offset)&lt;/code&gt; rather than &lt;code&gt;read()+write()&lt;/code&gt; to append new points), our recommended back-end.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi3_processtime_readwrite_vs_offset.png&quot; alt=&quot;gnocchi3_processtime_readwrite_vs_offset&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To summarize, since most data points are sent sequentially and ordered, we enhanced the data format to profit from that fact and be able to be appended without reading anything. That only works on Ceph though, which provides the needed features.&lt;/p&gt;
&lt;p&gt;We also enabled data compression on all storage drivers by enabling LZ4 compression (&lt;a href=&quot;https://julien.danjou.info/blog/gnocchi-carbonara-timeseries-compression&quot;&gt;see my previous article and research on the subject&lt;/a&gt;), which obviously offers its own set of challenges when using append-only write. The results are tremendous and decrease data usage by a huge factor:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi3_disksize.png&quot; alt=&quot;gnocchi3_disksize&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The rest of the processing pipeline also has been largely improved:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi3_processtime_post.png&quot; alt=&quot;gnocchi3_processtime_post&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi3_processtime_compress_offset.png&quot; alt=&quot;gnocchi3_processtime_compress_offset&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Overall, we&apos;re delighted with the performance improvement we achieved, and we&apos;re looking forward making even better more progress. Gnocchi is now one of the most performing and scalable timeseries databases out there.&lt;/p&gt;
&lt;h2&gt;Upcoming challenges&lt;/h2&gt;
&lt;p&gt;With that big change done, we&apos;re now heading toward a set of more lightweight improvements. Our &lt;a href=&quot;https://bugs.launchpad.net/gnocchi&quot;&gt;bug tracker&lt;/a&gt; is a good place to learn what might be on our mind (check for the &lt;em&gt;wishlist&lt;/em&gt; bugs).&lt;/p&gt;
&lt;p&gt;Improving our API features and offering a better experience for those coming outside of the real of OpenStack are now on my top priority list.&lt;/p&gt;
&lt;p&gt;But let me know if there&apos;s anything you have scratching you, obviously. 😎&lt;/p&gt;
</content:encoded><category>gnocchi</category><category>openstack</category></item><item><title>From decimal to timestamp with MySQL</title><link>https://julien.danjou.info/blog/python-sqlalchemy-from-decimal-to-timestamp/</link><guid isPermaLink="true">https://julien.danjou.info/blog/python-sqlalchemy-from-decimal-to-timestamp/</guid><description>When working with timestamps, one question that often arises is the precision of those timestamps. Most software is good enough with a precision up to the second, and that&apos;s easy. But in some cases, l</description><pubDate>Thu, 08 Sep 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;When working with timestamps, one question that often arises is the precision of those timestamps. Most software is good enough with a precision up to the second, and that&apos;s easy. But in some cases, like working on metering, a finer precision is required.&lt;/p&gt;
&lt;p&gt;I don&apos;t know exactly why, and it makes me suffer every day, but &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; is really tied to &lt;a href=&quot;http://mysql.com&quot;&gt;MySQL&lt;/a&gt; (and its clones). It hurts because MySQL is a very poor solution if you want to leverage your database to actually solve problems. But that&apos;s how life is, unfair. And in the context of the projects I work on, that boils down to that we can&apos;t afford to not support MySQL.&lt;/p&gt;
&lt;p&gt;So here we are, needing to work with MySQL and at the same time requiring timestamp with a finer precision than just seconds. And guess what: MySQL did not support that until 2011.&lt;/p&gt;
&lt;h2&gt;No microseconds in MySQL? No problem: DECIMAL!&lt;/h2&gt;
&lt;p&gt;MySQL 5.6.4 (released in 2011), a beta version of MySQL 5.6 (hello MySQL, ever heard of &lt;a href=&quot;http://semver.org&quot;&gt;Semantic Versioning&lt;/a&gt;?), brought microsecond precision to timestamps. But the first stable version supporting that, MySQL 5.6.10, was only released in 2013. So for a long time, there was a problem without any solution.&lt;/p&gt;
&lt;p&gt;The obvious workaround, in this case, is to reassess your choices in technologies, discover that &lt;a href=&quot;https://www.postgresql.org/docs/7.1/static/datatype-datetime.html&quot;&gt;PostgreSQL supports microsecond precision for at least a decade&lt;/a&gt; and problem solved.&lt;/p&gt;
&lt;p&gt;This is not what happened in our case, and in order to support MySQL, one had to find a workaround. And so did they in our &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt; project, using a &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html&quot;&gt;&lt;code&gt;DECIMAL&lt;/code&gt;&lt;/a&gt; type instead of &lt;code&gt;DATETIME&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;DECIMAL&lt;/code&gt; type takes 2 arguments: the total number of digits you need to store, and how many in that total will be used for the fractional part. Knowing that the internal storage of MySQL uses 1 byte for 2 digits, 2 bytes for 4 digits, 3 bytes for 6 digits and 4 bytes for 9 digits, and that each part is stored independently, in order to maximize your storage space, you want to pick a number of digits that fits that correctly.&lt;/p&gt;
&lt;p&gt;This is why Ceilometer picked 14 for the integer part (9 digits on 4 bytes and 5 digits on 3 bytes) and 6 for the decimal part (3 bytes).&lt;/p&gt;
&lt;p&gt;Wait. It&apos;s stupid because:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;DECIMAL(20, 6)&lt;/code&gt; implies that you uses 14 digits for the integer part, which using epoch as a reference makes you able to encode timestamp &lt;code&gt;(10^14) - 1&lt;/code&gt; which is year 3170843. I am certain Ceilometer won&apos;t last that far.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;14 digits is 9 + 5 digits in MySQL which is 7 bytes, the same size that is used for 9 + 6 digits. So if you could have &lt;code&gt;DECIMAL(21, 6)&lt;/code&gt; for the same storage space (and go up to year 31690708 which is a nice bonus, right?)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Well, I guess the original author of the patch did not read the documentation entirely (&lt;code&gt;DECIMAL(20, 6)&lt;/code&gt; being on the MySQL documentation page as an example, I imagine it just has been copy-pasted blindly?).&lt;/p&gt;
&lt;p&gt;The best choice for this use case would have been &lt;code&gt;DECIMAL(17, 6)&lt;/code&gt; which would allow storing 11 digits for integer (5 bytes), supporting timestamp up to &lt;code&gt;(2^11)-1&lt;/code&gt; (year 5138), and 6 digits for decimal part (3 bytes), using only 8 bytes in total per timestamp.&lt;/p&gt;
&lt;p&gt;Nonetheless, this workaround has been implemented using a &lt;a href=&quot;http://sqlalchemy.org&quot;&gt;SQLAlchemy&lt;/a&gt; custom type and works as expected:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class PreciseTimestamp(sqlalchemy.types.TypeDecorator):
    &quot;&quot;&quot;Represents a timestamp precise to the microsecond.&quot;&quot;&quot;

    impl = sqlalchemy.DateTime

    def load_dialect_impl(self, dialect):
        if dialect.name == &apos;mysql&apos;:
            return sqlalchemy.dialect.type_descriptor(
                sqlalchemy.types.DECIMAL(precision=20,
                                         scale=6,
                                         asdecimal=True))
        return sqlalchemy.dialect.type_descriptor(self.impl)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Microseconds in MySQL? Damn, migration!&lt;/h2&gt;
&lt;p&gt;As I said, MySQL 5.6.4 brought microseconds precision to the table (pun intended). Therefore, it&apos;s a great time to migrate away from this hackish format to the brand new one.&lt;/p&gt;
&lt;p&gt;First, be aware that the default &lt;code&gt;DATETIME&lt;/code&gt; type has no microseconds precision: &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.7/en/datetime.html&quot;&gt;you have to specify how many digits you want as an argument&lt;/a&gt;.&lt;br /&gt;
To support microseconds, you should therefore use &lt;code&gt;DATETIME(6)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If we were using a great RDBMS, let&apos;s say, hum, PostgreSQL, we could do that&lt;br /&gt;
very easily, see:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;postgres=# CREATE TABLE foo (mytime decimal);
CREATE TABLE
postgres=# \d foo
      Table &quot;public.foo&quot;
 Column │  Type   │ Modifiers
────────┼─────────┼───────────
 mytime │ numeric │
postgres=# INSERT INTO foo (mytime) VALUES (1473254401.234);
INSERT 0 1
postgres=# ALTER TABLE foo ALTER COLUMN mytime SET DATA TYPE timestamp with time zone USING to_timestamp(mytime);
ALTER TABLE
postgres=# \d foo
              Table &quot;public.foo&quot;
 Column │           Type           │ Modifiers
────────┼──────────────────────────┼───────────
 mytime │ timestamp with time zone │

postgres=# select * from foo;
           mytime
────────────────────────────
 2016-09-07 13:20:01.234+00
(1 row)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And since this is a pretty common use case, it&apos;s even &lt;a href=&quot;https://www.postgresql.org/docs/9.5/static/sql-altertable.html&quot;&gt;an example in the PostgreSQL documentation&lt;/a&gt;. The version from the documentation uses a calculation based on epoch, whereas my example here leverages the &lt;code&gt;to_timestamp()&lt;/code&gt; function. That&apos;s my personal touch.&lt;/p&gt;
&lt;p&gt;Obviously, doing this conversion in a single line is not possible with MySQL: it does not implement the &lt;code&gt;USING&lt;/code&gt; keyword on &lt;code&gt;ALTER TABLE … ALTER COLUMN&lt;/code&gt;. So what&apos;s the solution gonna be? Well, it&apos;s a 4 steps job:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a new column of type &lt;code&gt;DATETIME(6)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Copy data from the old column to the new column, converting them to the new format&lt;/li&gt;
&lt;li&gt;Delete the old column&lt;/li&gt;
&lt;li&gt;Rename the new column to the old column name.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;But I know what you&apos;re thinking: there are 4 steps, but that&apos;s not a problem, we&apos;ll just use a transaction and embed these operations inside.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.7/en/cannot-roll-back.html&quot;&gt;MySQL does not support transactions on data definition language (DDL)&lt;/a&gt;.&lt;br /&gt;
So if any of those steps fails, you&apos;ll be unable rollback steps 1, 3 and 4. Who knew that using MySQL was like living on the edge, right?&lt;/p&gt;
&lt;h2&gt;Doing this in Python with our friend Alembic&lt;/h2&gt;
&lt;p&gt;I like &lt;a href=&quot;http://alembic.zzzcomputing.com/&quot;&gt;Alembic&lt;/a&gt;. It&apos;s a Python library based on &lt;a href=&quot;http://sqlalchemy.org&quot;&gt;SQLAlchemy&lt;/a&gt; that handles schema migration for your favorite RDBMS.&lt;/p&gt;
&lt;p&gt;Once you created a new alembic migration script using &lt;code&gt;alembic revision&lt;/code&gt;, it&apos;s time to edit it and write something along those lines:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import func

class Timestamp(sa.types.TypeDecorator):
    &quot;&quot;&quot;Represents a timestamp precise to the microsecond.&quot;&quot;&quot;

    impl = sqlalchemy.DateTime

    def load_dialect_impl(self, dialect):
        if dialect.name == &apos;mysql&apos;:
            return dialect.type_descriptor(mysql.DATETIME(fsp=6))
        return self.impl

def upgrade():
    bind = op.get_bind()
    if bind and bind.engine.name == &quot;mysql&quot;:
        existing_type = sa.types.DECIMAL(
            precision=20, scale=6, asdecimal=True)
        existing_col = sa.Column(&quot;mytime&quot;, existing_type, nullable=False)
        temp_col = sa.Column(&quot;mytime_ts&quot;, Timestamp(), nullable=False)
        # Step 1: ALTER TABLE mytable ADD COLUMN mytime_ts DATETIME(6)
        op.add_column(&quot;mytable&quot;, temp_col)
        t = sa.sql.table(&quot;mytable&quot;, existing_col, temp_col)
        # Step 2: UPDATE mytable SET mytime_ts=from_unixtime(mytime)
        op.execute(t.update().values(mytime_ts=func.from_unixtime(existing_col)}))
        # Step 3: ALTER TABLE mytable DROP COLUMN mytime
        op.drop_column(&quot;mytable&quot;, &quot;mytime&quot;)
        # Step 4: ALTER TABLE mytable CHANGE mytime_ts mytime
        # Note: MySQL needs to have all the old/new information to just rename a column…
        op.alter_column(&quot;mytable&quot;,
                        &quot;mytime_ts&quot;,
                        nullable=False,
                        type_=Timestamp(),
                        existing_nullable=False,
                        existing_type=existing_type,
                        new_column_name=&quot;mytime&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In MySQL, the function to convert a float to a UNIX timestamp is &lt;code&gt;from_unixtime()&lt;/code&gt;, so the script leverages it to convert the data. As said, you&apos;ll notice we don&apos;t bother using any kind of transaction, so if anything goes wrong, there&apos;s no rollback, and it won&apos;t be possible to re-run the migration without a manual intervention.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;TimestampUTC&lt;/code&gt; is a custom class that implements &lt;code&gt;sqlalchemy.DateTime&lt;/code&gt; using a &lt;code&gt;DATETIME(6)&lt;/code&gt; type for MySQL, and a regular &lt;code&gt;sqlalchemy.DateTime&lt;/code&gt; type for other back-ends. It is used by the rest of the code (e.g. ORM model) but I&apos;ve pasted it in this example for a better understanding.&lt;/p&gt;
&lt;p&gt;Once written, you can easily test your migration using &lt;a href=&quot;https://github.com/jd/pifpaf&quot;&gt;&lt;em&gt;pifpaf&lt;/em&gt;&lt;/a&gt; to run a temporary database:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ pifpaf run mysql $SHELL
$ alembic -c alembic/alembic.ini upgrade 1c98ac614015 # upgrade to the initial revision
$ mysql -S $PIFPAF_MYSQL_SOCKET pifpaf
mysql&amp;gt; INSERT INTO mytable (mytime) VALUES (1325419200.213000);
Query OK, 1 row affected (0.00 sec)

mysql&amp;gt; SELECT * FROM mytable;
+-------------------+
| mytime            |
+-------------------+
| 1325419200.213000 |
+-------------------+
1 row in set (0.00 sec)

$ alembic -c alembic/alembic.ini upgrade head

$ mysql -S $PIFPAF_MYSQL_SOCKET pifpaf
mysql&amp;gt; SELECT * FROM mytable;
+----------------------------+
| mytime                     |
+----------------------------+
| 2012-01-01 13:00:00.213000 |
+----------------------------+
1 row in set (0.00 sec)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And voilà, we just migrated unsafely our data to a new fancy format. Thank you Alembic for solving a problem we would not have without MySQL. 😊&lt;/p&gt;
</content:encoded><category>python</category><category>databases</category><category>openstack</category></item><item><title>A retrospective of the OpenStack Telemetry project Newton cycle</title><link>https://julien.danjou.info/blog/retrospective-openstack-telemetry-newton/</link><guid isPermaLink="true">https://julien.danjou.info/blog/retrospective-openstack-telemetry-newton/</guid><description>A few weeks ago, I recorded an interview with Krishnan Raghuram about what was discussed for this development cycle for OpenStack Telemetry at the Austin summit.  It&apos;s interesting to look back at this</description><pubDate>Mon, 05 Sep 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A few weeks ago, I recorded an interview with Krishnan Raghuram about what was discussed for this development cycle for OpenStack Telemetry at the Austin summit.&lt;/p&gt;
&lt;p&gt;It&apos;s interesting to look back at this video more than 3 months after recording it, and see what actually happened to Telemetry. It turns out that some of the things that I think were going to happen did not happen yet. As the first release candidate version is approaching, it&apos;s very unlikely they happen.&lt;/p&gt;
&lt;p&gt;And on the other side, some new fancy features arrived suddenly without me having a clue about them.&lt;/p&gt;
&lt;p&gt;As far as &lt;strong&gt;Ceilometer&lt;/strong&gt; is concerned, here&apos;s the list of what really happened in terms of user features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Added full support for SNMP v3 USM model&lt;/li&gt;
&lt;li&gt;Added support for batch measurement in Gnocchi dispatcher&lt;/li&gt;
&lt;li&gt;Set ended_at timestamp in Gnocchi dispatcher&lt;/li&gt;
&lt;li&gt;Allow Swift pollster to specify regions&lt;/li&gt;
&lt;li&gt;Add L3 cache usage and memory bandwidth meters&lt;/li&gt;
&lt;li&gt;Split out the event code (REST API and storage) to a new &lt;strong&gt;Panko&lt;/strong&gt; project&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And a few other minor things. I planned none of them except Panko (which I was responsible for), and the ones we planned (documentation update, pipeline rework and polling enhancement) did not happen yet.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;Aodh&lt;/strong&gt;, we expected to rework the documentation entirely too, and that did not happen either. What we did instead:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Deprecate and disable combination alarms&lt;/li&gt;
&lt;li&gt;Add pagination support in REST API&lt;/li&gt;
&lt;li&gt;Deprecated all non-SQL database store and provide a tool to migrate&lt;/li&gt;
&lt;li&gt;Support batch notification for aodh-notifier&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It&apos;s definitely a good list of new features for Aodh, still small, but simplifying it, removing technical debt and continuing building momentum around it.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;Gnocchi&lt;/strong&gt;, we really had no plan, except maybe a few small features (they&apos;re usually tracked in the Launchpad bug list). It turned out we had some fancy new idea with Gordon Chung on how to boost our storage engine, so we work on that. That kept us busy a few weeks in the end, though the preliminary results look tremendous – so it was definitely worth it. We also have a AWS S3 storage driver on its way.&lt;/p&gt;
&lt;p&gt;I find this exercise interesting, as it really emphasizes how you can&apos;t really control what&apos;s happening in any open source project, where your contributors come and go and work on their own agenda.&lt;/p&gt;
&lt;p&gt;That does not mean we&apos;re dropping the themes and ideas I&apos;ve laid out in that video. We&apos;re still pushing our &quot;documentation is mandatory&quot; policy and improving our &quot;work by default&quot; scenario. It&apos;s just a longer road that we expected.&lt;/p&gt;
</content:encoded><category>openstack</category><category>gnocchi</category></item><item><title>The bad practice in FOSS projects management</title><link>https://julien.danjou.info/blog/foss-projects-management-bad-practice/</link><guid isPermaLink="true">https://julien.danjou.info/blog/foss-projects-management-bad-practice/</guid><description>During the OpenStack summit a few weeks ago, I had the chance to talk to some people about my experience on running open source projects. It turns out that after hanging out in communities and contrib</description><pubDate>Thu, 09 Jun 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;During the OpenStack summit a few weeks ago, I had the chance to talk to some people about my experience on running open source projects. It turns out that after hanging out in communities and contributing to many projects for years, I may be able to provide some hindsight and an external eye to many of those who are new to it.&lt;/p&gt;
&lt;p&gt;There are plenty of resource explaining how to run an open source projects out there. Today, I would like to take a different angle and emphasize what you should not &lt;em&gt;socially&lt;/em&gt; do in your projects. This list comes from various open source projects I encountered these past years. I&apos;m going to go through some of the bad practice I&apos;ve spotted, in a random order, illustrated by some concrete example.&lt;/p&gt;
&lt;h2&gt;Seeing contributors as an annoyance&lt;/h2&gt;
&lt;p&gt;When software developers and maintainers are busy, there&apos;s one thing they don&apos;t need: more work. To many people, the instinctive reactions to external contribution is: damn, more work. And actually, it is.&lt;/p&gt;
&lt;p&gt;Therefore, some maintainers tend to avoid that surplus of work: they state they don&apos;t want contributions, or make contributors feel un-welcomed. This can take a lot of different forms, from ignoring them to being unpleasant. It indeed avoids the immediate need to deal with the work that has been added on the maintainer shoulders.&lt;/p&gt;
&lt;p&gt;This is one of the biggest mistake and misconception of open source. If people are sending you more work, you should do whatever it takes to feel them welcome so they continue working with you. They might pretty soon become the guys doing the work you are doing instead of you. Think: retirement!&lt;/p&gt;
&lt;p&gt;Let&apos;s take a look at my friend Gordon, who I saw starting as a Ceilometer contributor in 2013. He was doing great code reviews, but he was actually giving me more work by catching bugs in my patches and sending patches I had to review. Instead of being a bully so he would stop making me rework my code and reviews his patches, &lt;a href=&quot;http://lists.openstack.org/pipermail/openstack-dev/2013-May/008975.html&quot;&gt;I requested that we trust him even more by adding him as a core reviewer&lt;/a&gt;. time contribution.&lt;/p&gt;
&lt;p&gt;And if they don&apos;t do this one-time contribution, they won&apos;t make it two. They won&apos;t make any. Those projects may have just lost their new maintainers.&lt;/p&gt;
&lt;h2&gt;Letting people only do the grunt work&lt;/h2&gt;
&lt;p&gt;When new contributors arrive and want to contribute to a particular project, they may have very different motivation. Some of them are users, but some of them are just people looking to see how it is to contribute. Getting the thrill of contribution, as an exercise, or as a willingness to learn and start contributing back to the ecosystem they use.&lt;/p&gt;
&lt;p&gt;The usual response from maintainers is to push people into doing grunt work. That means doing jobs that have no interest, little value, and probably no direct impact on the project.&lt;/p&gt;
&lt;p&gt;Some people actually have no problem with it, some have. Some will feel offended to do low impact work, and some will love it as soon as you give them some sort of acknowledgment. Be aware of it, and be sure to high-five people doing it. That&apos;s the only way to keep them around.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/computer-coding.jpg&quot; alt=&quot;computer-coding&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Not valorizing small contributions&lt;/h2&gt;
&lt;p&gt;When the first patch that comes in from a new contributor is a typo fix, what developers think? That they don&apos;t care, that you&apos;re wasting their precious time with your small contribution. And nobody cares about bad English in the documentation, don&apos;t they?&lt;/p&gt;
&lt;p&gt;This is wrong. See my first contributions to &lt;a href=&quot;https://github.com/home-assistant/home-assistant/commit/36cb12cd157b22bdc1fa28b700ca0fb751cca7a4&quot;&gt;home-assistant&lt;/a&gt; and &lt;a href=&quot;https://github.com/marijnh/Postmodern/commit/ec537f72393e1032853b78e0b7b4d0ff98632a02&quot;&gt;Postmodern&lt;/a&gt;: I fixed typos in the documentation.&lt;/p&gt;
&lt;p&gt;I contributed to &lt;a href=&quot;http://orgmode.org&quot;&gt;Org-mode&lt;/a&gt; for a few years. &lt;a href=&quot;http://repo.or.cz/org-mode.git/commit/a153f5a31dffbc6b78a8c5d8d027961abe585a38&quot;&gt;My first patch to orgmode&lt;/a&gt; was about fixing a docstring. Then, I sent 56 patches, fixing bugs and adding fancy features and also wrote a few external modules. To this day, I&apos;m still #16 in the top-committer list of Org-mode who contains 390 contributors. So not that would call a small contributor. I am sure the community is glad they did not despise my documentation fix.&lt;/p&gt;
&lt;h2&gt;Setting the bar too high for new comers&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/too-high.png&quot; alt=&quot;too-high&quot; /&gt;&lt;/p&gt;
&lt;p&gt;When new contributors arrive, their knowledge about the project, its context, and the technologies can vary largely. One of the mistakes people often make is to ask contributors too complicated things that they cannot realize. That scares them away (many people are going to be shy or introvert) and they may just disappear, feeling too stupid to help.&lt;/p&gt;
&lt;p&gt;Before making any comment, you should not have any assumption about their knowledge. That should avoid such situation. You also should be very delicate when assessing their skills, as some people might feel vexed if you underestimate them too much.&lt;/p&gt;
&lt;p&gt;Once that level has been properly evaluated (a few exchanges should be enough), you need to mentor to the right degree your contributor so it can blossom. It takes time and experience to master this, and you may likely lose some of them in the process, but it&apos;s a path every maintainer has to take.&lt;/p&gt;
&lt;p&gt;Mentoring is a very important aspect of welcoming new contributors to your project, whatever it is. Pretty sure that applies nicely outside free software too.&lt;/p&gt;
&lt;h2&gt;Requiring people to make sacrifices with their lives&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/balance-stones.jpg&quot; alt=&quot;balance-stones&quot; /&gt;&lt;/p&gt;
&lt;p&gt;This is an aspect that varies a lot depending on the project and context, but it&apos;s really important. As a free software project, where most people will contribute on their own good will and sometimes spare time, you must not require them to make big sacrifices. This won&apos;t work.&lt;/p&gt;
&lt;p&gt;One of the worst implementation of that is requiring people to fly 5 000 kilometers to meet in some place to discuss the project. This puts contributors in an unfair position, based on their ability to leave their family for a week, take a plane/boat/car/train, rent an hotel, etc. This is not good, and everything should be avoided to &lt;em&gt;require&lt;/em&gt; people to do that in order to participate and feel included in the project and blend in your community. Don&apos;t get me wrong: that does not me social activities should be prohibited, on the contrary. Just avoid excluding people when you discuss any project.&lt;/p&gt;
&lt;p&gt;The same apply to any other form of discussion that makes it complicated for everyone to participate: IRC meetings (it&apos;s hard for some people to book an hour, especially depending on the timezone they live in), video-conference (especially using non-free software), etc.&lt;/p&gt;
&lt;p&gt;Everything that requires people to basically interact with the project in a synchronous manner for a period of time will put constraints on them that can make them uncomfortable.&lt;/p&gt;
&lt;p&gt;The best medium is still e-mail and asynchronous derivative (bug trackers, etc), as it is asynchronous and allow people to work at their own pace at their own time.&lt;/p&gt;
&lt;h2&gt;Not having an (implicit) CoC&lt;/h2&gt;
&lt;p&gt;Codes of conduct seem to be a trendy topic (and a touchy subject), as more and more communities are opening to a wilder audience than they used to be – which is great.&lt;/p&gt;
&lt;p&gt;Actually, all communities have a code of conduct, being written with black ink or being carried in everyone&apos;s mind unconsciously. Its form is a matter of community size and culture.&lt;/p&gt;
&lt;p&gt;Now, depending on the size of your community and how you feel comfortable applying it, you may want to have it composed in a document, e.g. like &lt;a href=&quot;https://www.debian.org/code_of_conduct&quot;&gt;Debian did&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Having a code of conduct does not transform your whole project community magically into a bunch of carebears following its guidance. But it provides an interesting point you can refer to as soon as you need. It can help throwing it at some people, to indicate that their behavior is not welcome in the project, and somehow, ease their potential exclusion – even if nobody wants to go that far generally, and that&apos;s it&apos;s rarely that useful.&lt;/p&gt;
&lt;p&gt;I don&apos;t think it&apos;s mandatory to have such a paper on smaller projects. But you have to keep in mind that the implicit code of conduct will be derived from &lt;em&gt;your&lt;/em&gt; own behavior. The way your leader(s) will communicate with others will set the entire social mood of the project. Do not underestimate that.&lt;/p&gt;
&lt;p&gt;When we started the &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt; project, we implicitly followed the &lt;a href=&quot;https://www.openstack.org/legal/community-code-of-conduct/&quot;&gt;OpenStack Code of Conduct&lt;/a&gt; before it even existed, and probably set the bar a little higher. Being nice, welcoming and open-minded, we achieved a descent score of diversity, having up to 25% of our core team being women – way above the current ratio in OpenStack and most open source projects!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/friends-beach.jpg&quot; alt=&quot;friends-beach&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Making people not English native feeling like outsider&lt;/h2&gt;
&lt;p&gt;It&apos;s quite important to be aware of that the vast majority of free software project out there are using English as the common language of communication. It makes a lot of sense: it&apos;s a commonly spoken language, and it seems to do the job correctly.&lt;/p&gt;
&lt;p&gt;But a large part of the hackers out there are not native English speakers. Many are not able to speak English fluently. That means the rate at which they can communicate and run a conversation might be very low, which can make some people frustrated, especially native English speaker.&lt;/p&gt;
&lt;p&gt;The principal demonstration of this phenomena can be seen in social events (e.g. conferences) where people are debating. It can be very hard for people to explain their thoughts in English and to communicate properly at a decent rate, making the conversation and the transmission of ideas slow. The worst thing that one can see in this context is an English native speaker cutting people off and ignoring them, just because they are talking too slowly. I do understand that it can be frustrating, but the problem here is not the non-native English speaking, it&apos;s the medium being used that does not make your fellow on the same level of everyone by moving the conversation orally.&lt;/p&gt;
&lt;p&gt;To a lesser extent, the same applies to IRC meetings, which are by relatively synchronous. Completely asynchronous media do not have this flaw, that&apos;s why they should also be preferred in my opinion.&lt;/p&gt;
&lt;h2&gt;No vision, no delegation&lt;/h2&gt;
&lt;p&gt;Two of the most commonly encountered mistakes in open source projects: seeing the maintainer struggling with the growth of its project while having people trying to help.&lt;/p&gt;
&lt;p&gt;Indeed, when the flow of contributor starts coming in, adding new features, asking for feedback and directions, some maintainers choke and don&apos;t know how to respond. That ends up frustrating contributors, which therefore may simply vanish.&lt;/p&gt;
&lt;p&gt;It&apos;s important to have a vision for your project and communicate it. Make it clear for contributors what you want or don&apos;t want in your project. Transferring that in a clear (and non-aggressive, please) manner, is a good way of lowering the friction between contributors. They&apos;ll pretty soon know if they want to join your ship or not, and what to expect. So be a good captain.&lt;/p&gt;
&lt;p&gt;If they chose to work with you and contribute, you should start trusting them as soon as you can and delegate some of your responsibilities. This can be anything that you used to do: review patches targeting some subsystem, fixing bugs, writing docs. Let people own an entire part of the project so they feel responsible and care about it as much as you do. Doing the opposite, which is being a control-freak, is the best shot at staying alone with your open source software.&lt;/p&gt;
&lt;p&gt;And no project is going to grow and be successful that way.&lt;/p&gt;
&lt;p&gt;In 2009, when Uli Schlachter sent &lt;a href=&quot;http://article.gmane.org/gmane.comp.window-managers.awesome.devel/1746/match=uli+schlachter&quot;&gt;his first patch to awesome&lt;/a&gt;, this was more work for me. I had to review this patch, and I was already pretty busy designing the new versions of awesome and doing my day job! Uli&apos;s work was not perfect, and I had to fix it myself. More work. And what did I do? A few minutes later, I &lt;a href=&quot;http://article.gmane.org/gmane.comp.window-managers.awesome.devel/1747/match=uli+schlachter&quot;&gt;replied to him&lt;/a&gt; with a clear plan of what he should do and what I thought about his work.&lt;/p&gt;
&lt;p&gt;In response, Uli sent patches and improved the project. Do you know what Uli does today? He manages the awesome window manager project since 2010 instead of me. I managed to transmit my vision, delegate, and then retired!&lt;/p&gt;
&lt;h2&gt;Non-recognition of contributions&lt;/h2&gt;
&lt;p&gt;People contribute in different ways, and it&apos;s not always code. There&apos;s a lot of things around a free software projects: documentation, bug triage, user support, user experience design, communication, translation…&lt;/p&gt;
&lt;p&gt;It took a while for example to &lt;a href=&quot;http://debian.org&quot;&gt;Debian&lt;/a&gt; to recognize that their translators could have the status of Debian Developer. &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; is working in the same direction by trying to &lt;a href=&quot;https://wiki.openstack.org/wiki/NonATCRecognition&quot;&gt;recognize non-technical contributions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As soon as your project starts attributing badges to some people and creating classes of different members in the community, you should be very careful that you don&apos;t forget anyone. That&apos;s the easiest road to losing contributors along the road.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/heart-sign.jpg&quot; alt=&quot;heart-sign&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Don&apos;t forget to be thankful&lt;/h2&gt;
&lt;p&gt;This whole list has been inspired by many years of open source hacking and free software contributions. Everyone&apos;s experience and feeling might be different, or malpractice may have been seen under different forms. Let me know and if there&apos;s any other point that you encountered and blocked you to contribute to open source projects!&lt;/p&gt;
</content:encoded><category>open-source</category><category>openstack</category><category>awesome</category><category>debian</category><category>emacs</category></item><item><title>Gnocchi talk at the Paris Monitoring Meetup #6</title><link>https://julien.danjou.info/blog/paris-monitoring-6-gnocchi/</link><guid isPermaLink="true">https://julien.danjou.info/blog/paris-monitoring-6-gnocchi/</guid><description>Last week was the sixth edition of the Paris Monitoring Meetup, where I was invited as a speaker to present and talk about Gnocchi.</description><pubDate>Fri, 27 May 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Last week was the sixth edition of the &lt;a href=&quot;http://www.meetup.com/Paris-Monitoring/events/230515751/&quot;&gt;Paris Monitoring Meetup&lt;/a&gt;, where I was invited as a speaker to present and talk about &lt;a href=&quot;http://gnocchi.xyz&quot;&gt;Gnocchi&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/paris-monitoring.png&quot; alt=&quot;paris-monitoring&quot; /&gt;&lt;/p&gt;
&lt;p&gt;There was around 50 persons in the room, listening to my presentation of Gnocchi.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/jd-gnocchi-paris-monitoring-meetup-6.jpg&quot; alt=&quot;jd-gnocchi-paris-monitoring-meetup-6&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The talk went fine and I had a few interesting questions and feedback. One interesting point that keeps coming when talking about Gnocchi, is its OpenStack label, which scares away a lot of people. We definitely need to continue explaining that the project work stand-alone has a no dependency on OpenStack, just a great integration with it.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://www.monitoring-fr.org/&quot;&gt;Monitoring-fr&lt;/a&gt; organization also &lt;a href=&quot;http://www.monitoring-fr.org/2016/05/meetup-paris-monitoring-6-interview-de-julien-danjou-pour-gnocchi-metric-as-a-service/&quot;&gt;interviewed me&lt;/a&gt; after the meetup about Gnocchi. The interview is in French, obviously. I talk about Gnocchi, what it does, how it does it and why we started the project a couple of years ago. Enjoy, and let me know what you think!&lt;/p&gt;
</content:encoded><category>talks</category><category>monitoring</category><category>gnocchi</category><category>openstack</category></item><item><title>OpenStack Summit Newton from a Telemetry point of view</title><link>https://julien.danjou.info/blog/openstack-summit-newton-austin-telemetry/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-summit-newton-austin-telemetry/</guid><description>It&apos;s again that time of the year, where we all fly out to a different country to chat about OpenStack and what we&apos;ll do during the next 6 months.</description><pubDate>Mon, 02 May 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;It&apos;s again that time of the year, where we all fly out to a different country to chat about OpenStack and what we&apos;ll do during the next 6 months. This time, it was in &lt;a href=&quot;https://en.wikipedia.org/wiki/Austin,_Texas&quot;&gt;Austin, TX&lt;/a&gt; and we chatted about the new Newton release that will be out in October.&lt;/p&gt;
&lt;p&gt;As the &lt;em&gt;Project Team Leader&lt;/em&gt; for the Telemetry project, I set up and animated the week for our team. We had 9 discussion slots of 40 minutes assigned, but finally only used 8. We also, somehow, canceled the contributor team meet-up on the last day, as only a few of us developers were there and available.&lt;/p&gt;
&lt;p&gt;We took &lt;a href=&quot;https://wiki.openstack.org/wiki/Design_Summit/Newton/Etherpads#Telemetry&quot;&gt;a few notes in our Etherpads&lt;/a&gt;, but I think most of them were pretty sparse, as there was nothing really important we talked about. Actually, many topics were already discussed and covered 6 months ago in Tokyo during the previous summit. We just did not have time to implement everything we wanted, so talking over it again would not have been of a great help.&lt;/p&gt;
&lt;h2&gt;Reference architecture&lt;/h2&gt;
&lt;p&gt;Unfortunately, nor Gordon Chung nor the &lt;a href=&quot;https://osic.org/&quot;&gt;OpenStack Innovation Center&lt;/a&gt; had time to run the tests and benchmarks they wanted to run before the summit. We still discussed their plan to run tests and benchmark of the whole Telemetry suite (Ceilometer, Gnocchi &amp;amp; Aodh). They should run their tests for 3 weeks, no more, in a few weeks. The window to run tests being narrow, they want to be sure they are prepared, and will reach to us for help, ideas, and validation.&lt;/p&gt;
&lt;p&gt;I&apos;ve also requested them to, if possible, provide us some profiling (e.g. cProfile) data so we can have better knowledge of the area we can optimize.&lt;/p&gt;
&lt;h2&gt;Gnocchi, next steps&lt;/h2&gt;
&lt;p&gt;This session was particularly smooth since most people in the room were not up-to-date with Gnocchi 2.1. Some people expressed concerned about the InfluxDB driver removal, though they were not aware of the bugs it had, and that Gnocchi was actually performing better – so they may very likely be testing Gnocchi directly instead.&lt;/p&gt;
&lt;p&gt;No particular fancy feature was requested, only a few bugs and ideas noted on Launchpad were discussed.&lt;/p&gt;
&lt;h2&gt;Enhancing Ceilometer polling&lt;/h2&gt;
&lt;p&gt;This session was not particularly productive, as everything was we wanted to discuss was already on the Etherpad from… Tokyo, 6 months ago. It turns out nobody had time to pursue this project, so we&apos;ll see what happens. There&apos;s definitely some work to do to pursue our goal of splitting the pipeline definition into smaller files.&lt;/p&gt;
&lt;h2&gt;Aodh roadmap &amp;amp; improvements&lt;/h2&gt;
&lt;p&gt;First, we decided to definitely kill the combination alarm in the future, in favor of the new composite alarms definition that we like better.&lt;/p&gt;
&lt;p&gt;We should switch to &lt;a href=&quot;http://docs.openstack.org/developer/python-openstackclient/&quot;&gt;OpenStackClient&lt;/a&gt; in the future for &lt;a href=&quot;http://docs.openstack.org/developer/python-aodhclient/&quot;&gt;aodhclient&lt;/a&gt;. The OSC team indicated they are willing to provide a way to keep the &quot;aodh&quot; CLI command on its own, which is something that blocked us to move to OSC.&lt;/p&gt;
&lt;p&gt;A bunch of people indicated that had support for alarms CRUD in the Horizon dashboard. They should work together with the Horizon team to complete what has been started in Horizon recently to add Aodh support.&lt;/p&gt;
&lt;h2&gt;Ceilometer splitting&lt;/h2&gt;
&lt;p&gt;A year ago, we decided to split Ceilometer and its alarm feature: Aodh was born. We did discuss doing it again 6 months ago, but nothing happened as we already had so many stuff on our plate.&lt;/p&gt;
&lt;p&gt;As far as I&apos;m concerned, I think it&apos;s now time to split some Ceilometer functionality again, so I&apos;m going to do that this time with the event part. Gordon found a name, and this new project will be named &lt;em&gt;Panko&lt;/em&gt;.&lt;/p&gt;
&lt;h2&gt;Documentation&lt;/h2&gt;
&lt;p&gt;We have then discussed our documentation. Users present in the room were particularly happy with the Gnocchi policy that we apply since the beginning: no doc = no merge of your patch. The consensus is to move forward on this policy for all Telemetry projects, especially since it&apos;s now clear that the documentation team is not going to help us more. Ildikó, our documentation&lt;br /&gt;
wizard, will take care of making some links between the official OpenStack documentation and our projects, avoid content duplication.&lt;/p&gt;
&lt;p&gt;For this cycle, my personal plan is to document Aodh up to roughly 80 %, and then force that policy on newly implemented changes.&lt;/p&gt;
&lt;h2&gt;Events management&lt;/h2&gt;
&lt;p&gt;The event management part of Ceilometer and API (soon to be split in its own project as stated above) was discussed in this session. Nothing really exciting coming here, as nobody is willing to enhance it for now. Which, again, makes it a great candidate for splitting it out of Ceilometer.&lt;/p&gt;
&lt;h2&gt;Vitrage&lt;/h2&gt;
&lt;p&gt;The last session was dedicated to &lt;a href=&quot;https://wiki.openstack.org/wiki/Vitrage&quot;&gt;Vitrage&lt;/a&gt;, a root cause analysis tool built on OpenStack. The Vitrage team had a few features that they wanted to see in Aodh, so we discussed that at length. Notably, more support for sending notifications on events (alarm creation, deletion…) should be added in this next release.&lt;/p&gt;
&lt;p&gt;Also, a new alarm type that would be entirely managed and triggered over HTTP would be very useful for external projects such as Vitrage. We&apos;ll try to make that happen during this cycle too.&lt;/p&gt;
&lt;h2&gt;Talks&lt;/h2&gt;
&lt;p&gt;There were a few interesting talks about our telemetry projects during this summit, among other I highly recommend watching:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=W5KT5GJKJw8&quot;&gt;OpenStack Ceilometer with Gnocchi and Aodh Feature&lt;/a&gt;, where Amol and Paul from Ericsson explain what Gnocchi and Aodh do and how they work, and then help people deploy it on their lab.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=BdebhsBFEJs&quot;&gt;DPDK, Collectd &amp;amp; Ceilometer The Missing Link&lt;/a&gt;, where Ryota Mibu, one of the contributor to Aodh explains why he implemented the event alarm feature&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=-K8NI38LPtU&quot;&gt;Showback &amp;amp; Chargeback!! OpenStack Gnocchi + Cloudkitty as a Whole Billing System&lt;/a&gt;, where Maximiliano Venesio (Nubeliu) and Stéphane Albert (Objectif Libre) talk about how they built an amazing scalable billing solution using &lt;a href=&quot;http://gnocchi.xyz&quot;&gt;Gnocchi&lt;/a&gt; and &lt;a href=&quot;https://wiki.openstack.org/wiki/CloudKitty&quot;&gt;CloudKitty&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=0Q8pfbwxMb8&quot;&gt;Using Ceilometer Data for Effective Witch-Hunting&lt;/a&gt;, where Mike explain how Overstock.com leveraged Ceilometer to track anomalies in their cloud.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All of this should keep me and the team busy for the next cycle. If you have any question about what has been discussed or the future of our projects, don&apos;t hesitate to leave a comment or ask us on the &lt;a href=&quot;http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev&quot;&gt;OpenStack development mailing list&lt;/a&gt;.&lt;/p&gt;
</content:encoded><category>openstack</category><category>gnocchi</category></item><item><title>Gnocchi 2.1 release</title><link>https://julien.danjou.info/blog/gnocchi-2-1-release/</link><guid isPermaLink="true">https://julien.danjou.info/blog/gnocchi-2-1-release/</guid><description>A little less than 2 months after our latest major release, here is the new minor version of Gnocchi, stamped 2.1.0.</description><pubDate>Wed, 13 Apr 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A little less than 2 months after our latest major release, here is the new minor version of Gnocchi, stamped &lt;a href=&quot;https://launchpad.net/gnocchi/2.1/2.1.0&quot;&gt;2.1.0&lt;/a&gt;. It was a smooth release, but with one major feature implemented by my fellow fantastic developer Mehdi Abaakouk: the ability to create resource types dynamically.&lt;/p&gt;
&lt;h2&gt;Resource types REST API&lt;/h2&gt;
&lt;p&gt;This new version of Gnocchi offers the long-awaited ability to create resource types dynamically. What does that mean? Well, until version 2.0, the resources that you were able to create in Gnocchi had a particular type that was defined in the code: instance, volume, SNMP host, Swift account, etc. All of them were tied to OpenStack, since it was our primary use case.&lt;/p&gt;
&lt;p&gt;Now, &lt;a href=&quot;http://gnocchi.xyz/rest.html#resource-types&quot;&gt;the API allows to create resource types dynamically&lt;/a&gt;. This means you can create your own custom types to describe your own architecture. You then can exploit the same features that were offered before: history of your resources, searching through them, associating metrics, etc!&lt;/p&gt;
&lt;h2&gt;Performances improvement&lt;/h2&gt;
&lt;p&gt;We did some profiling on Gnocchi, and some benchmarks, and with the help of my fellow developer Gordon Chung, improved the metric performances.&lt;/p&gt;
&lt;p&gt;The API speed improved a bit, and I&apos;ve measured the Gnocchi API endpoint of being able to ingest up to 190k measures/s with only one node (the same as used in my &lt;a href=&quot;https://julien.danjou.info/blog/gnocchi-benchmarks&quot;&gt;previous benchmark&lt;/a&gt;) using &lt;a href=&quot;https://uwsgi-docs.readthedocs.org/&quot;&gt;uwsgi&lt;/a&gt;, so a 50 % improvement. The time required to compute aggregation on new measures is now also metered and displayed in the &lt;code&gt;gnocchi-metricd&lt;/code&gt; log in debug mode. Handy to have an idea of how fast your measures are treated.&lt;/p&gt;
&lt;h2&gt;Ceph backend optimization&lt;/h2&gt;
&lt;p&gt;The Ceph back-end has been improved again by Mehdi. We&apos;re now relying on OMAP rather than xattr for finer grained control and better performance.&lt;/p&gt;
&lt;p&gt;We already have a few new features being prepared for our next release, so stay tuned! And if you have any suggestion, feel free to say a word.&lt;/p&gt;
</content:encoded><category>gnocchi</category><category>openstack</category></item><item><title>Pifpaf, or how to run any daemon briefly</title><link>https://julien.danjou.info/blog/pifpaf-a-tool-to-run-daemon-briefly/</link><guid isPermaLink="true">https://julien.danjou.info/blog/pifpaf-a-tool-to-run-daemon-briefly/</guid><description>There&apos;s a lot of situation where you end up needing a software deployed temporarily. This can happen when testing something manually, when running a script or when launching a test suite.  Indeed, man</description><pubDate>Fri, 08 Apr 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;There&apos;s a lot of situation where you end up needing a software deployed temporarily. This can happen when testing something manually, when running a script or when launching a test suite.&lt;/p&gt;
&lt;p&gt;Indeed, many applications need to use and interconnect with external software: a RDBMS (&lt;a href=&quot;http://postgressql.org&quot;&gt;PostgreSQL&lt;/a&gt;, &lt;a href=&quot;http://mysql.org&quot;&gt;MySQL&lt;/a&gt;…), a cache (&lt;a href=&quot;http://memcached.org&quot;&gt;memcached&lt;/a&gt;, &lt;a href=&quot;http://redis.io&quot;&gt;Redis&lt;/a&gt;…) or any other external component. This tends to make more difficult running a software (or its test suite). If you want to rely on this component being installed and deployed, you end up needing a full environment set-up and properly configured to run your tests. Which is discouraging.&lt;/p&gt;
&lt;p&gt;The different &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; projects I work on ended up pretty soon spawning some of their back-ends temporarily to run their tests. Some of those unit tests somehow became entirely what you would call functional or integration tests. But that&apos;s just a name. In the end, what we ended up doing is testing that the software was really working. And there&apos;s no better way doing that than talking to a real PostgreSQL instance rather than mocking every call.&lt;/p&gt;
&lt;h2&gt;Pifpaf to the rescue&lt;/h2&gt;
&lt;p&gt;To solve that issue, I created a new tool, named &lt;em&gt;&lt;a href=&quot;https://github.com/jd/pifpaf&quot;&gt;Pifpaf&lt;/a&gt;&lt;/em&gt;. &lt;em&gt;Pifpaf&lt;/em&gt; eases the run of any daemon in a test mode for a brief moment, before making it disappear completely. It&apos;s pretty easy to install as &lt;a href=&quot;http://pypi.python.org/pypi/pifpaf&quot;&gt;it is available on PyPI&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ pip install pifpaf
Collecting pifpaf
[…]
Installing collected packages: pifpaf
Successfully installed pifpaf-0.0.7
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can then use it to run any of the listed daemons:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ pifpaf list
+---------------+
| Daemons       |
+---------------+
| redis         |
| postgresql    |
| mongodb       |
| zookeeper     |
| aodh          |
| influxdb      |
| ceph          |
| elasticsearch |
| etcd          |
| mysql         |
| memcached     |
| rabbitmq      |
| gnocchi       |
+---------------+
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Pifpaf&lt;/em&gt; accepts any shell command line to execute after its arguments:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ pifpaf run postgresql -- psql
Expanded display is used automatically.
Line style is unicode.
SET
psql (9.5.2)
Type &quot;help&quot; for help.

template1=# \l
                              List of databases
   Name    │ Owner │ Encoding │   Collate   │    Ctype    │ Access privileges
───────────┼───────┼──────────┼─────────────┼─────────────┼───────────────────
 postgres  │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │
 template0 │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │ =c/jd            ↵
           │       │          │             │             │ jd=CTc/jd
 template1 │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │ =c/jd            ↵
           │       │          │             │             │ jd=CTc/jd
(3 rows)

template1=# create database foobar;
CREATE DATABASE
template1=# \l
                              List of databases
   Name    │ Owner │ Encoding │   Collate   │    Ctype    │ Access privileges
───────────┼───────┼──────────┼─────────────┼─────────────┼───────────────────
 foobar    │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │
 postgres  │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │
 template0 │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │ =c/jd            ↵
           │       │          │             │             │ jd=CTc/jd
 template1 │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │ =c/jd            ↵
           │       │          │             │             │ jd=CTc/jd
(4 rows)

template1=# \q
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What &lt;em&gt;pifpaf&lt;/em&gt; does is that it runs the different commands needed to create a new PostgreSQL cluster and then run PostgreSQL on a temporary port for you. So your &lt;em&gt;psql&lt;/em&gt; session actually connects to a temporary PostgreSQL server, that is trashed as soon as you quit &lt;em&gt;psql&lt;/em&gt;. And all of that in less than 10 seconds, without the use of any virtualization or container technology!&lt;/p&gt;
&lt;p&gt;You can see what it does in detail using the &lt;em&gt;debug&lt;/em&gt; mode:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ pifpaf --debug run mysql $SHELL
DEBUG: pifpaf.drivers: executing: [&apos;mysqld&apos;, &apos;--initialize-insecure&apos;, &apos;--datadir=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmpkut9bg&apos;]
DEBUG: pifpaf.drivers: executing: [&apos;mysqld&apos;, &apos;--datadir=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmpkut9bg&apos;, &apos;--pid-file=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmpkut9bg/mysql.pid&apos;, &apos;--socket=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmpkut9bg/mysql.socket&apos;, &apos;--skip-networking&apos;, &apos;--skip-grant-tables&apos;]
DEBUG: pifpaf.drivers: executing: [&apos;mysql&apos;, &apos;--no-defaults&apos;, &apos;-S&apos;, &apos;/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmpkut9bg/mysql.socket&apos;, &apos;-e&apos;, &apos;CREATE DATABASE test;&apos;]
[…]
$ exit
[…]
DEBUG: pifpaf.drivers: mysqld output: 2016-04-08T08:52:04.202143Z 0 [Note] InnoDB: Starting shutdown...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Pifpaf&lt;/em&gt; also supports my pet project &lt;a href=&quot;http://launchpad.net/gnocchi&quot;&gt;Gnocchi&lt;/a&gt;, so you can run and try that timeseries database in a snap:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ pifpaf run gnocchi $SHELL
$ gnocchi metric create
+------------------------------------+-----------------------------------------------------------------------+
| Field                              | Value                                                                 |
+------------------------------------+-----------------------------------------------------------------------+
| archive_policy/aggregation_methods | std, count, 95pct, min, max, sum, median, mean                        |
| archive_policy/back_window         | 0                                                                     |
| archive_policy/definition          | - points: 12, granularity: 0:05:00, timespan: 1:00:00                 |
|                                    | - points: 24, granularity: 1:00:00, timespan: 1 day, 0:00:00          |
|                                    | - points: 30, granularity: 1 day, 0:00:00, timespan: 30 days, 0:00:00 |
| archive_policy/name                | low                                                                   |
| created_by_project_id              | admin                                                                 |
| created_by_user_id                 | admin                                                                 |
| id                                 | ff825d33-c8c8-46d4-b696-4b1e8f84a871                                  |
| name                               | None                                                                  |
| resource/id                        | None                                                                  |
+------------------------------------+-----------------------------------------------------------------------+
$ exit
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And it takes less than 10 seconds to launch Gnocchi on my laptop using &lt;em&gt;pifpaf&lt;/em&gt;. I&apos;m then able to play with the &lt;code&gt;gnocchi&lt;/code&gt; command line tool. It&apos;s by far faster than using OpenStack &lt;a href=&quot;http://devstack.org&quot;&gt;devstack&lt;/a&gt; to deloy everything the software.&lt;/p&gt;
&lt;h2&gt;Using &lt;em&gt;pifpaf&lt;/em&gt; with your test suite&lt;/h2&gt;
&lt;p&gt;We leverage &lt;em&gt;Pifpaf&lt;/em&gt; in several of our OpenStack telemetry related projects now, and even in &lt;a href=&quot;http://launchpad.net/tooz&quot;&gt;tooz&lt;/a&gt;. For example, to run unit/functional tests with a &lt;em&gt;memcached&lt;/em&gt; server available, a &lt;code&gt;tox.ini&lt;/code&gt; file should like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[testenv:py27-memcached]
commands = pifpaf run memcached -- python setup.py testr
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The tests can then use the environment variable &lt;code&gt;PIFPAF_MEMCACHED_PORT&lt;/code&gt; to connect to &lt;em&gt;memcached&lt;/em&gt; and run tests using it. As soon as the tests are finished, &lt;em&gt;memcached&lt;/em&gt; is killed by &lt;em&gt;pifpaf&lt;/em&gt; and the temporary data are trashed.&lt;/p&gt;
&lt;p&gt;We move a few OpenStack projects to using &lt;em&gt;Pifpaf&lt;/em&gt; already, and I&apos;m planning to make use of it in a few more. My fellow developer &lt;a href=&quot;http://sileht.net&quot;&gt;Mehdi Abaakouk&lt;/a&gt; added support for &lt;a href=&quot;http://rabbitmq.com&quot;&gt;RabbitMQ&lt;/a&gt; in &lt;em&gt;Pifpaf&lt;/em&gt; and &lt;a href=&quot;https://review.openstack.org/#/c/301771&quot;&gt;added support for more advanced tests&lt;/a&gt; in &lt;a href=&quot;http://launchpad.net/oslo.messaging&quot;&gt;oslo.messaging&lt;/a&gt; (such as failure scenarios) using &lt;em&gt;Pifpaf&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Pifpaf&lt;/em&gt; is a very small and handy tool. Give it a try and let me know how it works for you!&lt;/p&gt;
</content:encoded><category>python</category><category>openstack</category></item><item><title>The OpenStack Schizophrenia</title><link>https://julien.danjou.info/blog/openstack-schizophrenia/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-schizophrenia/</guid><description>When I started contributing to OpenStack, almost five years ago, it was a small ecosystem. There were no foundation, a handful of projects and you could understand the code base in a few days.</description><pubDate>Wed, 30 Mar 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;When I started contributing to &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt;, almost five years ago, it was a small ecosystem. There were no foundation, a handful of projects and you could understand the code base in a few days.&lt;/p&gt;
&lt;p&gt;Fast forward 2016, and it is a totally different beast. The project grew to &lt;a href=&quot;http://governance.openstack.org/reference/projects/index.html&quot;&gt;no less than 54 teams&lt;/a&gt;, each team providing one or more deliverable. For example, the Nova and Swift team each one produces one service and its client, whereas the Telemetry team produces 3 services and 3 different clients.&lt;/p&gt;
&lt;p&gt;In 5 years, OpenStack went to a few &lt;a href=&quot;https://en.wikipedia.org/wiki/Infrastructure_as_a_service&quot;&gt;IaaS&lt;/a&gt; projects, to 54 different teams tackling different areas related to cloud computing. Once upon a time, OpenStack was all about starting some virtual machines on a network, backed by images and volumes. Nowadays, it&apos;s also about orchestrating your network deployment over containers, while managing your application life-cycle using a database service, everything being metered and billed for.&lt;/p&gt;
&lt;p&gt;This exponential growth has been made possible with the decision of the &lt;a href=&quot;http://governance.openstack.org/reference/charter.html&quot;&gt;OpenStack Technical Committee&lt;/a&gt; to open the gates with &lt;a href=&quot;http://governance.openstack.org/resolutions/20141202-project-structure-reform-spec.html&quot;&gt;the project structure reform voted at the end of 2014&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This amendment suppresses the old OpenStack model of &quot;integrated projects&quot; (i.e. Nova, Glance, Swift…). The big tent, as it&apos;s called, allowed OpenStack to land new projects every month, growing from the 20 project teams of December 2014 to the 54 we have today – multiplying the number of projects by 2.7 in a little more than a year.&lt;/p&gt;
&lt;p&gt;Amazing growth, right?&lt;/p&gt;
&lt;p&gt;And this was clearly a good change. I sat at the Technical Committee in 2013, when projects were trying to apply to be &quot;integrated&quot;, after Ceilometer and Heat were. It was painful to see how the Technical Committee was trying to assess whether new projects should be brought in or not.&lt;/p&gt;
&lt;p&gt;But what I notice these days, is how OpenStack is still stuck between its old and new models. On one side, it accepted a lot of new teams, but on the other side, many are considered as second-class citizens. Efforts are made to continue to build an OpenStack project that does not exist anymore.&lt;/p&gt;
&lt;p&gt;For example, there is a team trying to define what&apos;s OpenStack core, named &lt;a href=&quot;https://github.com/openstack/defcore&quot;&gt;DefCore&lt;/a&gt;. That is looking to define which projects are, somehow, actually OpenStack. This leads to weird situations, &lt;a href=&quot;http://lists.openstack.org/pipermail/openstack-dev/2016-March/090214.html&quot;&gt;such as having non-DefCore projects seeing their doc rejected from installation guides&lt;/a&gt;.&lt;br /&gt;
Again, &lt;a href=&quot;http://lists.openstack.org/pipermail/openstack-dev/2016-March/090231.html&quot;&gt;I reiterated my proposal&lt;/a&gt; to publish documentation as part of each project code to solve that dishonest situation and put everything on a level playing field&lt;/p&gt;
&lt;p&gt;Some cross-projects specs are also pushed without implication of all OpenStack projects. For example, The &lt;a href=&quot;https://specs.openstack.org/openstack/openstack-specs/specs/deprecate-cli.html&quot;&gt;deprecate-cli&lt;/a&gt; spec which proposes to deprecate command-line interface tools proposed by each project had a lot of sense in the old OpenStack sense, where the goal was to build a unified and ubiquitous cloud platform. But when you now have tens of projects with largely different scopes, this start making less sense. Still, this spec was merged by the OpenStack Technical Committee this cycle. Keystone is the first project to proudly force users to rely on&lt;br /&gt;
&lt;a href=&quot;http://docs.openstack.org/developer/python-openstackclient/&quot;&gt;openstack-client&lt;/a&gt;, removing its old &lt;code&gt;keystone&lt;/code&gt; command line tool. I find it odd to push that specs when it&apos;s pretty clear that some projects (e.g. Swift, Gnocchi…) have no intention to go down that path.&lt;/p&gt;
&lt;p&gt;Unfortunately, most specs pushed by the Technical Committee are in the realm of wishful thinking. It somehow makes sense, since only a few of the members are actively contributing to OpenStack projects, and they can&apos;t by themselves implement all of that magically. But OpenStack is no exception in the free software world and remains a do-ocracy.&lt;/p&gt;
&lt;p&gt;There is good cross-project content in OpenStack, such as &lt;a href=&quot;https://wiki.openstack.org/wiki/API_Working_Group&quot;&gt;the API working group&lt;/a&gt;. While the work done should probably not be OpenStack specific, there&apos;s a lot that teams have learned by building various HTTP REST API with different frameworks. Compiling this knowledge and offering it as a guidance to various teams is a great help.&lt;/p&gt;
&lt;p&gt;My fellow developer &lt;a href=&quot;https://anticdent.org&quot;&gt;Chris Dent&lt;/a&gt; wrote a post about &lt;a href=&quot;https://anticdent.org/if-i-were-on-the-openstack-tc.html&quot;&gt;what he would do on the Technical Committee&lt;/a&gt;.&lt;br /&gt;
In this article, he points to a lot of the shortcomings I described here, and his confusion between OpenStack being a product or being a kit is quite understandable. Indeed, the message broadcasted by OpenStack is still very confusing after the big tent openness. There&apos;s no enough user experience improvement being done.&lt;/p&gt;
&lt;p&gt;The OpenStack Technical Committee election is opened for April 2016, and from what I read so far, many candidates are proposing to now clean up the big tent, kicking out projects that do not match certain criteria anymore. This is probably a good idea, there is some inactive project laying around. But I don&apos;t think that will be enough to solve the identity crisis that OpenStack is experiencing.&lt;/p&gt;
&lt;p&gt;So this is why, once again this cycle, I will throw my hat in the ring and submit my candidacy for OpenStack Technical Committee.&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>Gnocchi 2.0 release</title><link>https://julien.danjou.info/blog/gnocchi-2-0-release/</link><guid isPermaLink="true">https://julien.danjou.info/blog/gnocchi-2-0-release/</guid><description>Gnocchi 2.0 is out with major new features including a Grafana datasource, Ceph storage driver, and a revamped REST API.</description><pubDate>Fri, 19 Feb 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A little more than 3 months after our latest minor release, here is the new major version of Gnocchi, stamped &lt;a href=&quot;https://launchpad.net/gnocchi/2.0/2.0.0&quot;&gt;2.0.0&lt;/a&gt;. It contains a lot of new and exciting features, and I&apos;d like to talk about some of them to celebrate!&lt;/p&gt;
&lt;p&gt;You may notice that this release happens in the middle of the OpenStack release cycle. Indeed, Gnocchi does not follow that 6-months cycle, and we release whenever our code is ready. That forces us to have a more iterative approach, less disruptive for other projects and allow us to achieve a higher velocity. Applying the good old mantra &lt;em&gt;release early, release often&lt;/em&gt;.&lt;/p&gt;
&lt;h2&gt;Documentation&lt;/h2&gt;
&lt;p&gt;This version features a large documentation update. Gnocchi is still the only OpenStack server project that implements a &quot;no doc, no merge&quot; policy, meaning any code must come with the documentation addition or change included in the patch. The full documentation is included in the source code and available online at &lt;a href=&quot;http://gnocchi.xyz/&quot;&gt;gnocchi.xyz&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Data split &amp;amp; compression&lt;/h2&gt;
&lt;p&gt;I&apos;ve already covered this change extensively in &lt;a href=&quot;https://julien.danjou.info/blog/gnocchi-carbonara-timeseries-compression&quot;&gt;my last blog about timeseries compression&lt;/a&gt;. Long story short, Gnocchi now splits timeseries archives in small chunks that are compressed, increasing speed and decreasing data size.&lt;/p&gt;
&lt;h2&gt;Measures batching support&lt;/h2&gt;
&lt;p&gt;Gnocchi now supports batching, which allow submitting several measures for different metric in a single request. This is especially useful in the context where your application tends to cache metrics for a while and is able to send them in a batch. Usage is &lt;a href=&quot;http://gnocchi.xyz/rest.html#measures-batching&quot;&gt;fully documented for the REST API&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Group by support in aggregation&lt;/h2&gt;
&lt;p&gt;One of the most demanded features was the ability to do measure aggregation no resource, using a group by type query. This is now possible using the &lt;a href=&quot;http://gnocchi.xyz/rest.html#aggregation-across-metrics&quot;&gt;new &lt;code&gt;groupby&lt;/code&gt; parameter to aggregation queries&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Ceph backend optimization&lt;/h2&gt;
&lt;p&gt;We improved the Ceph back-end a lot. Mehdi Abaakouk wrote a new Python binding for Ceph, called &lt;a href=&quot;https://github.com/sileht/pycradox&quot;&gt;Cradox&lt;/a&gt;, that is going to replace the current Python rados module in the subsequent Ceph releases. Gnocchi makes usage of this new module to speed things up, making the Ceph based driver really, really faster than before. We also implemented asynchronous data deletion, which improves performance a bit.&lt;/p&gt;
&lt;p&gt;The next step will be to run some new benchmarks &lt;a href=&quot;https://julien.danjou.info/blog/gnocchi-benchmarks&quot;&gt;like I did a few months ago&lt;/a&gt; and compare with the Gnocchi 1.3 series. Stay tuned!&lt;/p&gt;
</content:encoded><category>gnocchi</category><category>openstack</category></item><item><title>Gnocchi 1.3.0 release</title><link>https://julien.danjou.info/blog/gnocchi-1-3-0-released/</link><guid isPermaLink="true">https://julien.danjou.info/blog/gnocchi-1-3-0-released/</guid><description>Finally, Gnocchi 1.3.0 is out. This is our final release, more or less matching the OpenStack 6 months schedule, that concludes the Liberty development cycle.</description><pubDate>Wed, 04 Nov 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Finally, &lt;a href=&quot;https://launchpad.net/gnocchi/trunk/1.3.0&quot;&gt;Gnocchi 1.3.0&lt;/a&gt; is out. This is our final release, more or less matching the OpenStack 6 months schedule, that concludes the Liberty development cycle.&lt;/p&gt;
&lt;p&gt;This release was supposed to be released a few weeks earlier, but our integration test got completely blocked for several days just the week before the OpenStack Mitaka summit.&lt;/p&gt;
&lt;h2&gt;New website&lt;/h2&gt;
&lt;p&gt;We build a new dedicated website for Gnocchi at &lt;a href=&quot;http://gnocchi.xyz&quot;&gt;gnocchi.xyz&lt;/a&gt;. We want to promote Gnocchi outside of the &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; bubble, as it a useful timeseries database on its own that can work without the rest of the stack. We&apos;ll try to improve the documentation. If you&apos;re curious, feel free to check it out and report anything you miss!&lt;/p&gt;
&lt;h2&gt;The speed bump&lt;/h2&gt;
&lt;p&gt;Obviously, if it was a bug in Gnocchi that we have hit, it would have been quick to fix. However, we found &lt;a href=&quot;https://bugs.launchpad.net/python-keystoneclient/+bug/1508424&quot;&gt;a nasty bug&lt;/a&gt; in Swift caused by the evil monkey-patching of Eventlet (once again) blended with a mixed usage of native threads and Eventlet threads in Swift. Shake all of that, and you got yourself pretty race conditions when using the Keystone middleware authentication.&lt;/p&gt;
&lt;p&gt;In the meantime, we disabled Swift multi-threading by using mod_wsgi instead of Eventlet in devstack.&lt;/p&gt;
&lt;h2&gt;New features&lt;/h2&gt;
&lt;p&gt;So what&apos;s new in this new shiny release? A few interesting things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Metric deletion is now asynchronous. That&apos;s not the most used feature in the REST API – weirdly people do not often delete metrics – but it&apos;s now way faster and reliable by being asynchronous. &lt;em&gt;Metricd&lt;/em&gt; is now in charge of cleaning up things up.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Speed improvement. We are now confident to be even more faster than in the &lt;a href=&quot;https://julien.danjou.info/blog/gnocchi-benchmarks&quot;&gt;latest benchmarks I run&lt;/a&gt; (around 1.5-2× faster), which makes Gnocchi &lt;em&gt;really&lt;/em&gt; fast with its native storage back-ends. We profiled and optimized Carbonara and the REST API data validation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Improve &lt;em&gt;metricd&lt;/em&gt; status report. It now reports the size of the backlog of the whole cluster both in its log and via the REST API. Easy monitoring!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ceph drivers enhancement. We had people testing the Ceph drivers in production, so we made a few changes and fixes to it to make it more solid.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And that&apos;s all we did in the last couple of months. We have a lot of things on the roadmap that are pretty exciting, and I&apos;ll sure talk about them in the next weeks.&lt;/p&gt;
</content:encoded><category>gnocchi</category><category>openstack</category></item><item><title>OpenStack Summit Mitaka from a Telemetry point of view</title><link>https://julien.danjou.info/blog/openstack-summit-mitaka-tokyo-telemetry/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-summit-mitaka-tokyo-telemetry/</guid><description>Last week I was in Tokyo, Japan for the OpenStack Summit, discussing the new Mitaka version that will be released in 6 months.</description><pubDate>Mon, 02 Nov 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Last week I was in Tokyo, Japan for the &lt;a href=&quot;https://www.openstack.org/summit/tokyo-2015/&quot;&gt;OpenStack Summit&lt;/a&gt;, discussing the new Mitaka version that will be released in 6 months.&lt;/p&gt;
&lt;p&gt;I&apos;ve attended the summit mainly to discuss and follow-up new developments on &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt;, &lt;a href=&quot;http://launchpad.net/gnocchi&quot;&gt;Gnocchi&lt;/a&gt;, &lt;a href=&quot;http://launchpad.net/aodh&quot;&gt;Aodh&lt;/a&gt; and Oslo. It has been a pretty good week and we were able to discuss and plan a few interesting things. Below are what I found remarkable during this summit concerning those projects.&lt;/p&gt;
&lt;h2&gt;Distributed lock manager&lt;/h2&gt;
&lt;p&gt;I did not attend this session, but I need to write something about it.&lt;/p&gt;
&lt;p&gt;See, when working in a distributed environment like OpenStack, it&apos;s almost obvious that sooner or later you end up needing a distributed lock mechanism. It started to be pretty obvious and a serious problem for us 2 years ago in Ceilometer. Back then, we proposed the &lt;a href=&quot;https://wiki.openstack.org/wiki/Oslo/blueprints/service-sync&quot;&gt;service-sync&lt;/a&gt; blueprint and talked about it during the OpenStack Icehouse Design Summit in Hong-Kong. The session at that time was a success, and in 20 minutes I convinced everyone it was the good thing to do. The night following the session, we picked a named, Tooz, to name this new library. It was the first time I met Joshua Harlow, which became one of the biggest Tooz contributor since then.&lt;/p&gt;
&lt;p&gt;For the following months, we tried to move the lines in OpenStack. It was very hard to convince people that it was the solution to their problem. Most of the time, they did not seem to grasp the entirety of what was at stake.&lt;/p&gt;
&lt;p&gt;This time, it seems that we managed to convince everyone that a DLM is indeed needed. Joshua wrote an extensive specification called &lt;a href=&quot;https://review.openstack.org/#/c/209661/&quot;&gt;Chronicle of a DLM&lt;/a&gt;, which ended up being discussed and somehow adopted during that session in Tokyo.&lt;/p&gt;
&lt;p&gt;So yes, Tooz will be the weapon of choice for OpenStack. It will avoid a hard requirement on any DLM solution directly. The best driver right now is the &lt;a href=&quot;https://zookeeper.apache.org/&quot;&gt;ZooKeeper&lt;/a&gt; one, but it&apos;ll still be possible for operators to use e.g. Redis.&lt;/p&gt;
&lt;p&gt;This is a great achievement for us, after spending years trying to fix features such as the &lt;a href=&quot;https://blueprints.launchpad.net/nova/+spec/tooz-for-service-groups&quot;&gt;Nova service group subsystem&lt;/a&gt; and seeing our proposals postponed forever.&lt;/p&gt;
&lt;p&gt;(If you want to know more, &lt;a href=&quot;http://lwn.net&quot;&gt;LWN.net&lt;/a&gt; has&lt;br /&gt;
&lt;a href=&quot;https://lwn.net/Articles/662140/&quot;&gt;a great article about that session&lt;/a&gt;.)&lt;/p&gt;
&lt;h2&gt;Telemetry team name&lt;/h2&gt;
&lt;p&gt;With the new projects launched this last year, Aodh &amp;amp; Gnocchi, in parallel of the old Ceilometer, plus the change from programs to Big Tent in OpenSack, the team is having an identity issue. Being referred to as the &quot;Ceilometer team&quot; is not really accurate, as some of us only work on Aodh or on Gnocchi. So after discussing that, I &lt;a href=&quot;https://review.openstack.org/#/c/240809/&quot;&gt;proposed to rename the team to Telemetry&lt;/a&gt; instead. We&apos;ll see how it goes.&lt;/p&gt;
&lt;h2&gt;Alarms&lt;/h2&gt;
&lt;p&gt;The first session was about alarms and the Aodh project. It turns out that the project is in pretty good shape, but probably need some more love, which I hope I&apos;ll be able to provide in the next months.&lt;/p&gt;
&lt;p&gt;The need for a new &lt;em&gt;aodhclient&lt;/em&gt; based on the technologies we recently used building &lt;em&gt;gnocchiclient&lt;/em&gt; has been reasserted, so we might end up working on that pretty soon. The Tempest support also needs some improvement, and we have a plan to enhance that.&lt;/p&gt;
&lt;h2&gt;Data visualisation&lt;/h2&gt;
&lt;p&gt;We got David Lyle in this session, the Project Technical Leader for &lt;a href=&quot;http://openstack/horizon&quot;&gt;Horizon&lt;/a&gt;. It was an interesting discussion. It used to be technically challenging to draw charts from the data Ceilometer collects, but it&apos;s now very easy with Gnocchi and its API.&lt;/p&gt;
&lt;p&gt;While the technical side is resolved, the more political and user experience side of was to draw and how was discussed at length. We don&apos;t want to make people think that Ceilometer and Gnocchi are a full monitoring solution, so there&apos;s some precaution to take. Other than that, it would be pretty cool to have view of the data in Horizon.&lt;/p&gt;
&lt;h2&gt;Rolling upgrade&lt;/h2&gt;
&lt;p&gt;It turns out that Ceilometer has an architecture that makes it easy to have rolling upgrade. We just need to write a proper documentation explaining how to do it and in which order the services should be upgraded.&lt;/p&gt;
&lt;h2&gt;Ceilometer splitting&lt;/h2&gt;
&lt;p&gt;The split of the alarm feature of Ceilometer in its own project Aodh in the last cycle was a great success for the whole team. We want to split other pieces of Ceilometer, as they make sense on their own, makes it easier to manage. They are also some projects that want to use them without the whole stack, so that&apos;s a good idea to make it happen.&lt;/p&gt;
&lt;h2&gt;CloudKitty &amp;amp; Gnocchi&lt;/h2&gt;
&lt;p&gt;I attended the 2 sessions that were allocated to &lt;a href=&quot;https://wiki.openstack.org/wiki/CloudKitty&quot;&gt;CloudKitty&lt;/a&gt;. It was pretty interesting as they want to simplify their architecture and leverage what Gnocchi provides. I proposed my view of the project architecture and how they could leverage the more of Gnocchi to retrieve and store data. They want to go in that direction though it&apos;s a large amount of work and refactoring on their side, so it&apos;ll take time.&lt;/p&gt;
&lt;p&gt;We also need to enhance the support of extension for new resources in Gnocchi, and that&apos;s something I hope I&apos;ll work on in the next months.&lt;/p&gt;
&lt;p&gt;Overall, this summit was pretty good and I got a tremendous amount of good feedback on Gnocchi. I again managed to get enough ideas and tasks to tackle for the next 6 months. It really looks interesting to see where the whole team will go from that. Stay tuned!&lt;/p&gt;
</content:encoded><category>openstack</category><category>gnocchi</category></item><item><title>Benchmarking Gnocchi for fun &amp; profit</title><link>https://julien.danjou.info/blog/gnocchi-benchmarks/</link><guid isPermaLink="true">https://julien.danjou.info/blog/gnocchi-benchmarks/</guid><description>We got pretty good feedback on Gnocchi so far, even if we only had little. Recently, in order to have a better feeling of where we were at, we wanted to know how fast (or slow) Gnocchi was.</description><pubDate>Tue, 13 Oct 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;We got pretty good feedback on &lt;a href=&quot;http://launchpad.net/gnocchi&quot;&gt;Gnocchi&lt;/a&gt; so far, even if we only had little. Recently, in order to have a better feeling of where we were at, we wanted to know how fast (or slow) Gnocchi was.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://julien.danjou.info/openstack-ceilometer-the-gnocchi-experiment.html&quot;&gt;early benchmarks that some of the Mirantis engineers ran last year&lt;/a&gt; showed pretty good signs. But a year later, it was time to get real numbers and have a good understanding of Gnocchi capacity.&lt;/p&gt;
&lt;h2&gt;Benchmark tools&lt;/h2&gt;
&lt;p&gt;The first thing I realized when starting that process, is that we were lacking of tools to run benchmarks. Therefore I started to write some benchmark tools in &lt;a href=&quot;https://launchpad.net/python-gnocchiclient&quot;&gt;python-gnocchiclient&lt;/a&gt;, which provides a command line tool to interrogate Gnocchi. I added a few basic commands to measure metric performance, such as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ gnocchi benchmark metric create -w 48 -n 10000 -a low
+----------------------+------------------+
| Field                | Value            |
+----------------------+------------------+
| client workers       | 48               |
| create executed      | 10000            |
| create failures      | 0                |
| create failures rate | 0.00 %           |
| create runtime       | 8.80 seconds     |
| create speed         | 1136.96 create/s |
| delete executed      | 10000            |
| delete failures      | 0                |
| delete failures rate | 0.00 %           |
| delete runtime       | 39.56 seconds    |
| delete speed         | 252.75 delete/s  |
+----------------------+------------------+
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The command line tool supports the &lt;code&gt;--verbose&lt;/code&gt; switch to have detailed progress report on the benchmark progression. So far it supports metric operations only, but that&apos;s the most interesting part of Gnocchi.&lt;/p&gt;
&lt;h2&gt;Spinning up some hardware&lt;/h2&gt;
&lt;p&gt;I got a couple of bare metal servers to test Gnocchi on. I dedicated the first one to Gnocchi, and used the second one as the benchmark client, plugged on the same network. Each server is made of&lt;br /&gt;
2×&lt;a href=&quot;http://ark.intel.com/products/81897/Intel-Xeon-Processor-E5-2609-v3-15M-Cache-1_90-GHz&quot;&gt;Intel Xeon E5-2609 v3&lt;/a&gt; (12 cores in total) and 32 GB of RAM. That provides a lot of CPU to handle requests in parallel.&lt;/p&gt;
&lt;p&gt;Then I simply performed a basic &lt;a href=&quot;http://www.redhat.com/en/technologies/linux-platforms/enterprise-linux&quot;&gt;RHEL 7&lt;/a&gt; installation and ran &lt;a href=&quot;http://devstack.org&quot;&gt;devstack&lt;/a&gt; to spin up an installation of Gnocchi based on the master branch, disabling all of the others OpenStack components. I then tweaked the Apache httpd configuration to use the worker MPM and increased the maximum number of clients that can sent request simultaneously.&lt;/p&gt;
&lt;p&gt;I configured Gnocchi to use the &lt;em&gt;PostsgreSQL&lt;/em&gt; indexer, as it&apos;s the recommended one, and the &lt;em&gt;file&lt;/em&gt; storage driver, based on Carbonara (Gnocchi own storage engine). That means files were stored locally rather than in Ceph or Swift.&lt;/p&gt;
&lt;p&gt;Using the &lt;em&gt;file&lt;/em&gt; driver is less scalable (you have to run on only one node or uses a technology like NFS to share the files), but it was good enough for this benchmark and to have some numbers and profiling the beast.&lt;/p&gt;
&lt;p&gt;The OpenStack Keystone authentication middleware was not enabled in this setup, as it would add some delay validating the authentication token.&lt;/p&gt;
&lt;h2&gt;Metric CRUD operations&lt;/h2&gt;
&lt;p&gt;Metric creation is pretty fast. I managed to attain 1300 metric/s created pretty easily. Deletion is now asynchronous, which means it&apos;s faster than in Gnocchi 1.2, but it&apos;s still slower than creation: 500 metric/s can be deleted. That does not sound like a huge issue since metric deletion is actually barely used in production.&lt;/p&gt;
&lt;p&gt;Retrieving metric information is also pretty fast and goes up to 800 metric/s. It&apos;d be easy to achieve very higher throughput for this one, as it&apos;d be easy to cache, but we didn&apos;t feel the need to implement it so far.&lt;/p&gt;
&lt;p&gt;Another important thing is that all of these numbers are constant and barely depends on the number of the metric already managed by Gnocchi.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Details&lt;/th&gt;
&lt;th&gt;Rate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Create metric&lt;/td&gt;
&lt;td&gt;Created 100k metrics in 77 seconds&lt;/td&gt;
&lt;td&gt;1300 metric/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Show metric&lt;/td&gt;
&lt;td&gt;Show a metric 100k times in 149 seconds&lt;/td&gt;
&lt;td&gt;670 metric/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete metric&lt;/td&gt;
&lt;td&gt;Deleted 100k metrics in 190 seconds&lt;/td&gt;
&lt;td&gt;524 metric/s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;Sending and getting measures&lt;/h2&gt;
&lt;p&gt;Pushing measures into metrics is one of the hottest topic. Starting with Gnocchi 1.1, the measures pushed are treated asynchronously, which makes it much faster to push new measures. Getting new numbers on that feature was pretty interesting.&lt;/p&gt;
&lt;p&gt;The number of metric per second you can push depends on the batch size, meaning the number of actual measurements you send per call. The naive approach is to push 1 measure per call, and in that case, Gnocchi is able to handle around 600 measures/s. With a batch containing 100 measures, the number of calls per second goes down to 450, but since you push 100 measures each time, that means 45k measures per second pushed into Gnocchi!&lt;/p&gt;
&lt;p&gt;I&apos;ve pushed the test further, inspired by the recent &lt;a href=&quot;https://influxdb.com/blog/2015/10/07/the_new_influxdb_storage_engine_a_time_structured_merge_tree.html&quot;&gt;blog post of InfluxDB claiming to achieve 300k points per second&lt;/a&gt; with their new engine. I ran the same benchmark on the hardware I had, which is roughly two times smaller than the one they used. I achieved to push Gnocchi to a little more than 120k measurement per second. If I had same hardware as they used, I could interpolate the results to achieve almost 250k measures/s pushed. Obviously, you can&apos;t strictly compare Gnocchi and InfluxDB since they are not doing exactly the same thing, but it still looks way better than what I expected.&lt;/p&gt;
&lt;p&gt;Using smaller batch sizes of 1k or 2k improve the throughput further to around 125k measures/s.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Details&lt;/th&gt;
&lt;th&gt;Rate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Push metric 5k&lt;/td&gt;
&lt;td&gt;Push 5M measures with batch of 5k measures in 40 seconds&lt;/td&gt;
&lt;td&gt;122k measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push metric 4k&lt;/td&gt;
&lt;td&gt;Push 5M measures with batch of 4k measures in 40 seconds&lt;/td&gt;
&lt;td&gt;125k measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push metric 3k&lt;/td&gt;
&lt;td&gt;Push 5M measures with batch of 3k measures in 40 seconds&lt;/td&gt;
&lt;td&gt;123k measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push metric 2k&lt;/td&gt;
&lt;td&gt;Push 5M measures with batch of 2k measures in 41 seconds&lt;/td&gt;
&lt;td&gt;121k measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push metric 1k&lt;/td&gt;
&lt;td&gt;Push 5M measures with batch of 1k measures in 44 seconds&lt;/td&gt;
&lt;td&gt;113k measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push metric 500&lt;/td&gt;
&lt;td&gt;Push 5M measures with batch of 500 measures in 51 seconds&lt;/td&gt;
&lt;td&gt;98k measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push metric 100&lt;/td&gt;
&lt;td&gt;Push 5M measures with batch of 100 measures in 112 seconds&lt;/td&gt;
&lt;td&gt;45k measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push metric 10&lt;/td&gt;
&lt;td&gt;Push 5M measures with batch of 10 measures in 852 seconds&lt;/td&gt;
&lt;td&gt;6k measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push metric 1&lt;/td&gt;
&lt;td&gt;Push 500k measures with batch of 1 measure in 800 seconds&lt;/td&gt;
&lt;td&gt;624 measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Get measures&lt;/td&gt;
&lt;td&gt;Push 43k measures of 1 metric&lt;/td&gt;
&lt;td&gt;260k measures/s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;What about getting measures? Well, it&apos;s actually pretty fast too. Retrieving a metric with 1 month of data with 1 minute interval (that&apos;s 43k points) takes less than 2 second.&lt;/p&gt;
&lt;p&gt;Though it&apos;s actually slower than what I expected. The reason seems to be that the JSON is 2 MB big and encoding it takes a lot of time for Python. I&apos;ll investigate that. Another point I discovered, is that by default Gnocchi returns all the datapoints for each granularities available for the asked period, which might double the size of the returned data for nothing if you don&apos;t need it. It&apos;ll be easy to add an option to the API to only retrieve what you need though!&lt;/p&gt;
&lt;p&gt;Once benchmarked, that meant I was able to retrieve 6 metric/s per second, which translates to around 260k measures/s.&lt;/p&gt;
&lt;h2&gt;&lt;em&gt;Metricd&lt;/em&gt; speed&lt;/h2&gt;
&lt;p&gt;New measures that are pushed into Gnocchi are processed asynchronously by the &lt;code&gt;gnocchi-metricd&lt;/code&gt; daemon. When doing the benchmarks above, I ran into a very interesting issue: sending 10k measures on a metric would make &lt;code&gt;gnocchi-metricd&lt;/code&gt; uses up to 2 GB RAM and 120 % CPU for more than 10 minutes.&lt;/p&gt;
&lt;p&gt;After further investigation, I found that the naive approach we used to resample datapoints in Carbonara using &lt;a href=&quot;http://pandas.pydata.org/&quot;&gt;Pandas&lt;/a&gt; was causing that. I &lt;a href=&quot;https://github.com/pydata/pandas/issues/11217&quot;&gt;reported a bug on Pandas&lt;/a&gt; and the upstream author was kind enough to provide a nice workaround, that I sent as &lt;a href=&quot;https://github.com/pydata/pandas/pull/11242&quot;&gt;a pull request&lt;/a&gt; to Pandas documentation.&lt;/p&gt;
&lt;p&gt;I wrote a fix for Gnocchi based on that, and started using it. Computing the standard aggregation methods set (std, count, 95pct, min, max, sum, median, mean) for 10k batches of 1 measure (worst case scenario) for one metric with 10k measures now takes only 20 seconds and uses 100 MB of RAM – 45× faster. That means that in normal operations, where only a few new measures are processed, the operation of updating a metric only takes a few milliseconds. Awesome!&lt;/p&gt;
&lt;h2&gt;Comparison with Ceilometer&lt;/h2&gt;
&lt;p&gt;For comparison sake, I&apos;ve quickly run some read operations benchmark in Ceilometer. I&apos;ve fed it with one month of samples for 100 instances polled every minute. That represents roughly 4.3M samples injected, and that took a while – almost 1 hour whereas it would have taken less than a minute in Gnocchi. Then I tried to retrieve some statistics in the same way that we provide them in Gnocchi, which mean aggregating them over a period of 60 seconds over a month.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Details&lt;/th&gt;
&lt;th&gt;Rate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Read metric SQL&lt;/td&gt;
&lt;td&gt;Read measures for 1 metric&lt;/td&gt;
&lt;td&gt;2min 58s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read metric MongoDB&lt;/td&gt;
&lt;td&gt;Read measures for 1 metric&lt;/td&gt;
&lt;td&gt;28s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read metric Gnocchi&lt;/td&gt;
&lt;td&gt;Read measures for 1 metric&lt;/td&gt;
&lt;td&gt;2s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Obviously, Ceilometer is very slow. It has to look into 4M of samples to compute and return the result, which takes a lot of time. Whereas Gnocchi just has to fetch a file and pass it over. That also means that the more samples you have (so the more time you collect data and the more resources you have), slower Ceilometer will become. This is not a problem with Gnocchi, as I emphasized when I started designing it.&lt;/p&gt;
&lt;p&gt;Most Gnocchi operations are &lt;em&gt;O(log R)&lt;/em&gt; where R is the number of metrics or resources, whereas most Ceilometer operations are &lt;em&gt;O(log S)&lt;/em&gt; where S is the number of samples (measures). Since is R millions of time smaller than S, Gnocchi gets to be much faster.&lt;/p&gt;
&lt;p&gt;And what&apos;s even more interesting, is that Gnocchi is entirely scalable horizontally. Adding more Gnocchi servers (for the API and its background processing worker &lt;em&gt;metricd&lt;/em&gt;) will multiply Gnocchi performances by the number of servers added.&lt;/p&gt;
&lt;h2&gt;Improvements&lt;/h2&gt;
&lt;p&gt;There are several things to improve in Gnocchi, such as splitting Carbonara archives to make them more efficient, especially from drivers such as Ceph and Swift. It&apos;s already on my plate, and I&apos;m looking forwarding to working on that!&lt;/p&gt;
&lt;p&gt;And if you have any questions, feel free to shoot them in the comment section. 😉&lt;/p&gt;
</content:encoded><category>gnocchi</category><category>openstack</category></item><item><title>Gnocchi talk at OpenStack Paris Meetup #16</title><link>https://julien.danjou.info/blog/openstack-france-paris-meetup-gnocchi-talk/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-france-paris-meetup-gnocchi-talk/</guid><description>Last week, I&apos;ve been invited to the OpenStack Paris meetup #16, whose subject was about metrics in OpenStack. Last time I spoke at this meetup was back in 2012, during the OpenStack Paris meetup #2.</description><pubDate>Mon, 05 Oct 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Last week, I&apos;ve been invited to the &lt;a href=&quot;http://www.meetup.com/OpenStack-France/events/225227112/&quot;&gt;OpenStack Paris meetup #16&lt;/a&gt;, whose subject was about metrics in OpenStack. Last time I spoke at this meetup was back in 2012, during the &lt;a href=&quot;https://julien.danjou.info/blog/openstack-france-meetup-2&quot;&gt;OpenStack Paris meetup #2&lt;/a&gt;. A very long time ago!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi-talk-2.jpg&quot; alt=&quot;gnocchi-talk-2&quot; /&gt;&lt;/p&gt;
&lt;p&gt;I talked for half an hour about &lt;a href=&quot;http://launchpad.net/gnocchi&quot;&gt;Gnocchi&lt;/a&gt;, the OpenStack project I&apos;ve been running for 18 months now. I started by explaining the story behind the project and why we needed to build it. Ceilometer has an interesting history and had a curious roadmap these last year, and I summarized that briefly. Then I talk about how Gnocchi works and what it offers to users and operators. The slides where full of JSON, but I imagine it offered a interesting view of what the API looks like and how easy it is to operate. This also allowed me to emphasize how many use cases are actually really covered and solved, contrary to what Ceilometer did so far. The talk has been well received and I got a few interesting questions at the end.&lt;/p&gt;
</content:encoded><category>talks</category><category>openstack</category><category>gnocchi</category></item><item><title>My interview in le Journal du Hacker</title><link>https://julien.danjou.info/blog/interview-journal-du-hacker/</link><guid isPermaLink="true">https://julien.danjou.info/blog/interview-journal-du-hacker/</guid><description>Le Journal du Hacker interviewed me about my work on OpenStack, my job at Red Hat, and my self-published book The Hacker&apos;s Guide to Python.</description><pubDate>Thu, 17 Sep 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A few days ago, the French equivalent of &lt;a href=&quot;https://news.ycombinator.com/&quot;&gt;Hacker News&lt;/a&gt;, called &quot;&lt;a href=&quot;https://www.journalduhacker.net/&quot;&gt;Le Journal du Hacker&lt;/a&gt;&quot;, &lt;a href=&quot;https://www.journalduhacker.net/s/l5qktw/journal_du_hacker_entretien_avec_julien_danjou_d_veloppeur_openstack&quot;&gt;interviewed me&lt;/a&gt; about my work on &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt;, my job at &lt;a href=&quot;http://redhat.com&quot;&gt;Red Hat&lt;/a&gt; and my self-published book &lt;a href=&quot;https://thehackerguidetopython.com&quot;&gt;The Hacker&apos;s Guide to Python&lt;/a&gt;. I&apos;ve spent some time translating it into English so you can read it if you don&apos;t understand French! I hope you&apos;ll enjoy it.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Hi Julien, and thanks for participating in this interview for the Journal du Hacker. For our readers who don&apos;t know you, can you introduce you briefly?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You&apos;re welcome! My name is Julien, I&apos;m 31 years old, and I live in Paris. I now have been developing free software for around fifteen years. I had the pleasure to work (among other things) on &lt;a href=&quot;http://debian.org&quot;&gt;Debian&lt;/a&gt;, &lt;a href=&quot;https://www.gnu.org/software/emacs/&quot;&gt;Emacs&lt;/a&gt; and &lt;a href=&quot;http://awesome.naquadah.org&quot;&gt;awesome&lt;/a&gt; these last years, and more recently on OpenStack. Since a few months now, I work at Red Hat, as a Principal Software Engineer on &lt;a href=&quot;http://opensack.org&quot;&gt;OpenStack&lt;/a&gt;. I am in charge of doing upstream development for that cloud-computing platform, mainly around the Ceilometer, Aodh and Gnocchi projects.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Being myself a system architect, I follow your work in &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; since a while. It&apos;s uncommon to have the point of view of someone as implied as you are. Can you give us a summary of the state of the project, and then detail your activities in this project?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; project has grown and changed a lot since I started 4 years ago. It started as a few projects providing the basics, like &lt;a href=&quot;https://launchpad.net/nova&quot;&gt;Nova&lt;/a&gt; (compute), &lt;a href=&quot;https://launchpad.net/swift&quot;&gt;Swift&lt;/a&gt; (object storage), &lt;a href=&quot;https://launchpad.net/cinder&quot;&gt;Cinder&lt;/a&gt; (volume), &lt;a href=&quot;https://launchpad.net/keystone&quot;&gt;Keystone&lt;/a&gt; (identity) or even &lt;a href=&quot;https://launchpad.net/neutron&quot;&gt;Neutron&lt;/a&gt; (network) who are basis for a cloud-computing platform, and finally became composed of a lot more projects.&lt;/p&gt;
&lt;p&gt;For a while, the inclusion of projects was the subject of a strict review from the technical committee. But since a few months, the rules have been relaxed, and we see a lot more projects connected to cloud-computing &lt;a href=&quot;http://governance.openstack.org/reference/projects/&quot;&gt;joining us&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As far as I&apos;m concerned, I&apos;ve started with a few others people the &lt;a href=&quot;http://governance.openstack.org/reference/projects/ceilometer.html&quot;&gt;Ceilometer&lt;/a&gt; project in 2012, devoted to handling metrics of OpenStack platforms. Our goal is to be able to collect all the metrics and record them to analyze them later. We also have a module providing the ability to trigger actions on threshold crossing (alarm).&lt;/p&gt;
&lt;p&gt;The project grew in a monolithic way, and in a linear way for the number of contributors, during the first two years. I was the PTL (Project Technical Leader) for a year. This leader position asks for a lot of time for bureaucratic things and people management, so I decided to leave my spot in order to be able to spend more time solving the technical challenges that Ceilometer offered.&lt;/p&gt;
&lt;p&gt;I&apos;ve started the &lt;a href=&quot;https://launchpad.net/gnocchi&quot;&gt;Gnocchi&lt;/a&gt; project in 2014. The first stable version (1.0.0) was released a few months ago. It&apos;s a timeseries database offering a REST API and a strong ability to scale. It was a necessary development to solve the problems tied to the large amount of metrics created by a cloud-computing platform, where tens of thousands of virtual machines have to be metered as often as possible. This project works as a standalone deployment or with the rest of OpenStack.&lt;/p&gt;
&lt;p&gt;More recently, I&apos;ve started &lt;a href=&quot;https://launchpad.net/aodh&quot;&gt;Aodh&lt;/a&gt;, the result of moving out the code and features of Ceilometer related to threshold action triggering (alarming). That&apos;s the logical suite to what we started with Gnocchi. It means Ceilometer is to be split into independent modules that can work together – with or without OpenStack. It seems to me that the features provided by Ceilometer, Aodh and Gnocchi can also be interesting for operators running more classical infrastructures. That&apos;s why I&apos;ve pushed the projects into that direction, and also to have a more service-oriented architecture (&lt;a href=&quot;https://fr.wikipedia.org/wiki/Architecture_orient%C3%A9e_services&quot;&gt;SOA&lt;/a&gt;).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I&apos;d like to stop for a moment on Ceilometer. I think that this solution was very expected, especially by the cloud-computing providers using OpenStack for billing resources sold to their customers. I remember reading a blog post where you were talking about the high-speed construction of this brick, and features that were not supposed to be there. Nowadays, with Gnocchi and Aodh, what is the quality of the brick Ceilometer and the programs it relies on?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Indeed, one of the first use-case for Ceilometer was tied to the ability to get metrics to feed a billing tool. That&apos;s now a reached goal since we have billing tools for OpenStack using Ceilometer, such as &lt;a href=&quot;https://wiki.openstack.org/wiki/CloudKitty&quot;&gt;CloudKitty&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;However, other use-cases appeared rapidly, such as the ability to trigger alarms. This feature was necessary, for example, to implement the auto scaling feature that &lt;a href=&quot;http://launchpad.net/heat&quot;&gt;Heat&lt;/a&gt; needed. At the time, for technical and political reasons, it was not possible to implement this feature in a new project, and the functionality ended up in Ceilometer, since it was using the metrics collected and stored by Ceilometer itself.&lt;/p&gt;
&lt;p&gt;Though, like I said, this feature is now in its own project, Aodh. The alarm feature is used since a few cycles in production, and the Aodh project brings new features on the table. It allows to trigger threshold actions and is one of the few solutions able to work at high scale with several thousands of alarms.&lt;br /&gt;
It&apos;s impossible to make Nagios run with millions of instances to fetch metrics and triggers alarms. Ceilometer and Aodh can do that easily on a few tens of nodes automatically.&lt;/p&gt;
&lt;p&gt;On the other side, Ceilometer has been for a long time painted as slow and complicated to use, because its metrics storage system was by default using &lt;a href=&quot;https://www.mongodb.org/&quot;&gt;MongoDB&lt;/a&gt;. Clearly, the data structure model picked was not optimal for what the users were doing with the data.&lt;/p&gt;
&lt;p&gt;That&apos;s why I started Gnocchi last year, which is perfectly designed for this use case. It allows linear access time to metrics (O(1) complexity) and fast access time to the resources data via an index.&lt;/p&gt;
&lt;p&gt;Today, with 3 projects having their own perimeter of features defined – and which can work together – Ceilometer, Aodh and Gnocchi finally erased the biggest problems and defects of the initial project.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;To end with OpenStack, one last question. You&apos;re a &lt;a href=&quot;http://www.python.org/&quot;&gt;Python&lt;/a&gt; developer for a long time and a fervent user of software testing and &lt;a href=&quot;https://en.wikipedia.org/wiki/Test_driven_development&quot;&gt;test-driven development&lt;/a&gt;. Several of your blogs posts point how important their usage are. Can you tell us more about the usage of tests in OpenStack, and the test prerequisites to contribute to OpenStack?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I don&apos;t know any project that is as tested on every layer as OpenStack is. At the start of the project, there was a vague test coverage, made of a few unit tests. For each release, a bunch of new features were provided, and you had to keep your fingers crossed to have them working. That&apos;s already almost unacceptable. But the big issue was that there was also a lot of regressions, et things that were working were not anymore. It was often corner cases that developers forgot about that stopped working.&lt;/p&gt;
&lt;p&gt;Then the project decided to change its policy and started to refuse all patches – new features or bug fix – that would not implement a minimal set of unit tests, proving the patch would work. Quickly, regressions were history, and the number of bugs largely reduced months after months.&lt;/p&gt;
&lt;p&gt;Then came the functional tests, with the &lt;a href=&quot;http://launchpad.net/tempest&quot;&gt;Tempest&lt;/a&gt; project, which runs a test battery on a complete OpenStack deployment.&lt;/p&gt;
&lt;p&gt;OpenStack now possesses a &lt;a href=&quot;http://status.openstack.org/zuul/&quot;&gt;complete test infrastructure&lt;/a&gt;, with operators hired full-time to maintain them. The developers have to write the test, and the operators maintain an architecture based on Gerrit, Zuul, and Jenkins, which runs the test battery of each project for each patch sent.&lt;/p&gt;
&lt;p&gt;Indeed, for each version of a patch sent, a full OpenStack is deployed into a virtual machine, and a battery of thousands of unit and functional tests is run to check that no regressions are possible.&lt;/p&gt;
&lt;p&gt;To contribute to OpenStack, you need to know how to write a unit test – the policy on functional tests is laxer. The tools used are standard Python tools, unittest for the framework and &lt;a href=&quot;https://pypi.python.org/pypi/tox&quot;&gt;tox&lt;/a&gt; to run a virtual environment (venv) and run them.&lt;/p&gt;
&lt;p&gt;It&apos;s also possible to use &lt;a href=&quot;http://docs.openstack.org/developer/devstack/&quot;&gt;DevStack&lt;/a&gt; to deploy an OpenStack platform on a virtual machine and run functional tests. However, since the project infrastructure also do that when a patch is submitted, it&apos;s not mandatory to do that yourself locally.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The tools and tests you write for OpenStack are written in Python, a language which is very popular today. You seem to like it more than you have to, since you wrote a book about it, &lt;a href=&quot;https://thehackerguidetopython.com&quot;&gt;The Hacker&apos;s Guide to Python&lt;/a&gt;, that I really enjoyed. Can you explain what brought you to Python, the main strong points you attribute to this language (quickly) and how you went from developer to author?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I stumbled upon Python by chance, around 2005. I don&apos;t remember how I hear about it, but I bought a first book to discover it and started toying with that language. At that time, I didn&apos;t find any project to contribute to or to start. My first project with Python was rebuildd for Debian in 2007, a bit later.&lt;/p&gt;
&lt;p&gt;I like Python for its simplicity, its object orientation rather clean, its easiness to be deployed and its rich open source ecosystem. Once you get the basics, it&apos;s very easy to evolve and to use it for anything, because the ecosystem makes it easy to find libraries to solve any kind of problem.&lt;/p&gt;
&lt;p&gt;I became an author by chance, writing blog posts from time to time about Python. I finally realized that after a few years studying Python internals (CPython), I learned a lot of things. While writing a post about&lt;br /&gt;
&lt;a href=&quot;https://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods&quot;&gt;the differences between method types in Python&lt;/a&gt; – which is still one of the most read post on my blog – I realized that a lot of things that seemed obvious to me where not for other developers.&lt;/p&gt;
&lt;p&gt;I wrote that initial post after thousands of hours spent doing code reviews on OpenStack. I, therefore, decided to note all the developers pain points and to write a book about that. A compilation of what years of experience taught me and taught to the other developers I decided to interview in the book.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I&apos;ve been very interested by the publication of your book, for the subject itself, but also the process you chose. You self-published the book, which seems very relevant nowadays. Is that a choice from the start? Did you look for an editor? Can you tell use more about that?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I&apos;ve been lucky to find out about others self-published authors, such as &lt;a href=&quot;http://nathanbarry.com/&quot;&gt;Nathan Barry&lt;/a&gt; – who even wrote a book on that subject, called &lt;a href=&quot;http://nathanbarry.com/authority/&quot;&gt;Authority&lt;/a&gt;. That&apos;s what convinced me it was possible and gave me hints for that project.&lt;/p&gt;
&lt;p&gt;I&apos;ve started to write in August 2013, and I ran the firs interviews with other developers at that time. I started to write the table of contents and then filled the pages with what I knew and what I wanted to share. I manage to finish the book around January 2014. The proof-reading took more time than I expected, so the book was only released in March 2014. I wrote a &lt;a href=&quot;https://julien.danjou.info/blog/making-of-the-hacker-guide-to-python&quot;&gt;complete report&lt;/a&gt; about that on my blog, where I explain the full process in detail, from writing to launching.&lt;/p&gt;
&lt;p&gt;I did not look for editors though I&apos;ve been proposed some. The idea of self-publishing really convince me, so I decided to go on my own, and I have no regret. It&apos;s true that you have to wear two hats at the same time and handle a lot more things, but with a minimal audience and some help from the Internet, anything&apos;s possible!&lt;/p&gt;
&lt;p&gt;I&apos;ve been reached by two editors since then, a &lt;a href=&quot;http://item.jd.com/11685556.html&quot;&gt;Chinese&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/juldanjou/status/552056642322583552&quot;&gt;Korean&lt;/a&gt; one. I gave them rights to translate and publish the books in their countries, so you can buy the Chinese and Korean version of the first edition of the book out there.&lt;/p&gt;
&lt;p&gt;Seeing how successful it was, I decided to launch a second edition in May 2015, and it&apos;s likely that a third edition will be released in 2016.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Nowadays, you work for &lt;a href=&quot;http://www.redhat.com&quot;&gt;Red Hat&lt;/a&gt;, a company that represents the success of using Free Software as a commercial business model. This company fascinates a lot in our community. What can you say about your employer from your point of view?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It only has been a year since I joined Red Hat (when they bought &lt;a href=&quot;http://www.enovance.com/&quot;&gt;eNovance&lt;/a&gt;), so my experience is quite recent.&lt;/p&gt;
&lt;p&gt;Though, Red Hat is really a special company on every level. It&apos;s hard to see from the outside how open it is, and how it works. It&apos;s really close to and it really looks like an open source project. For more details, you should read &lt;a href=&quot;https://www.redhat.com/en/explore/the-open-organization-book&quot;&gt;The Open Organization&lt;/a&gt;, a book wrote by Jim Whitehurst (CEO of Red Hat), which he just published. It describes perfectly how Red Hat works. To summarize, meritocracy and the lack of organization in silos is what makes Red Hat a strong organization and puts them as&lt;br /&gt;
&lt;a href=&quot;http://www.forbes.com/innovative-companies/list/&quot;&gt;one of the most innovative company&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In the end, I&apos;m lucky enough to be autonomous for the project I work on with my team around OpenStack, and I can spend 100% working upstream and enhance the Python ecosystem.&lt;/p&gt;
</content:encoded><category>career</category><category>openstack</category><category>books</category><category>python</category></item><item><title>Visualize your OpenStack cloud: Gnocchi &amp; Grafana</title><link>https://julien.danjou.info/blog/openstack-gnocchi-grafana/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-gnocchi-grafana/</guid><description>We&apos;ve been hard working with the Gnocchi team these last months to store your metrics, and I guess it&apos;s time to show off a bit.  So far Gnocchi offers scalable metric storage and resource indexation,</description><pubDate>Mon, 14 Sep 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;We&apos;ve been hard working with the Gnocchi team these last months to store your metrics, and I guess it&apos;s time to show off a bit.&lt;/p&gt;
&lt;p&gt;So far Gnocchi offers scalable metric storage and resource indexation, especially for OpenStack cloud – but not only, we&apos;re generic. It&apos;s cool to store metrics, but it can be even better to have a way to visualize them!&lt;/p&gt;
&lt;h2&gt;Prototyping&lt;/h2&gt;
&lt;p&gt;We very soon started to build a little HTML interface. Being REST-friendly guys, we enabled it on the same endpoints that were being used to retrieve information and measures about metric, sending back &lt;code&gt;text/html&lt;/code&gt; instead of &lt;code&gt;application/json&lt;/code&gt; if you were requesting those pages from a Web browser.&lt;/p&gt;
&lt;p&gt;But let&apos;s face it: we are back-end developers, we suck at any kind front-end development. CSS, HTML, JavaScript? Bwah! So what we built was a starting point, hoping some magical Web developer would jump in and finish the job.&lt;/p&gt;
&lt;p&gt;Obviously it never happened.&lt;/p&gt;
&lt;h2&gt;Ok, so what&apos;s out there?&lt;/h2&gt;
&lt;p&gt;It turns out there are back-end agnostic solutions out there, and we decided to pick &lt;a href=&quot;http://grafana.org&quot;&gt;Grafana&lt;/a&gt;. Grafana is a complete graphing dashboard solution that can be plugged on top of any back-end. It already supports timeseries databases such as Graphite, InfluxDB and OpenTSDB.&lt;/p&gt;
&lt;p&gt;That was largely enough for that my fellow developer &lt;a href=&quot;https://blog.sileht.net/&quot;&gt;Mehdi Abaakouk&lt;/a&gt; to jump in and start writing a Gnocchi plugin for Grafana! Consequently, there is now a basic but solid and working back-end for Grafana that lies in the &lt;em&gt;&lt;a href=&quot;https://github.com/grafana/grafana-plugins/tree/master/datasources/gnocchi&quot;&gt;grafana-plugins&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
repository.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi-grafana.png&quot; alt=&quot;gnocchi-grafana&quot; /&gt;&lt;/p&gt;
&lt;p&gt;With that plugin, you can graph anything that is stored in Gnocchi, from raw metrics to metrics tied to resources. You can use templating, but no annotation yet.&lt;/p&gt;
&lt;p&gt;The back-end supports Gnocchi with or without Keystone involved, and any type of authentication (basic auth or Keystone token). So yes, it even works if you&apos;re not running Gnocchi with the rest of OpenStack.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi-grafana-group.png&quot; alt=&quot;gnocchi-grafana-group&quot; /&gt;&lt;/p&gt;
&lt;p&gt;It also supports advanced queries, so you can search for resources based on some criterion and graphs their metrics.&lt;/p&gt;
&lt;h2&gt;I want to try it!&lt;/h2&gt;
&lt;p&gt;If you want to deploy it, all you need to do is to install Grafana and its plugins, and create a new datasource pointing to Gnocchi. It is that simple. There&apos;s some CORS middleware configuration involved if you&apos;re planning on using Keystone authentication, but it&apos;s pretty straightforward – just set the &lt;code&gt;cors.allowed_origin&lt;/code&gt; option to the URL of your Grafana dashboard.&lt;/p&gt;
&lt;p&gt;We added support of Grafana directly in Gnocchi devstack plugin. If you&apos;re running &lt;a href=&quot;http://devstack.org&quot;&gt;DevStack&lt;/a&gt; you can follow &lt;a href=&quot;http://docs.openstack.org/developer/gnocchi/devstack.html&quot;&gt;the instructions&lt;/a&gt; – which are basically adding the line &lt;code&gt;enable_service gnocchi-grafana&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Moving to Grafana core&lt;/h2&gt;
&lt;p&gt;[Mehdi just opened a pull request] (&lt;a href=&quot;https://github.com/grafana/grafana/pull/2716&quot;&gt;https://github.com/grafana/grafana/pull/2716&lt;/a&gt;) a few days ago to merge the plugin into Grafana core. It&apos;s actually one of the most unit-tested plugin in Grafana so far, so it should be on a good path to be merged in the future and have support of Gnocchi directly into Grafana without any plugin involved.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/grafana-gnocchi-unittests.png&quot; alt=&quot;grafana-gnocchi-unittests&quot; /&gt;&lt;/p&gt;
</content:encoded><category>gnocchi</category><category>openstack</category><category>monitoring</category></item><item><title>Ceilometer, Gnocchi &amp; Aodh: Liberty progress</title><link>https://julien.danjou.info/blog/ceilometer-gnocchi-aodh-liberty-progress/</link><guid isPermaLink="true">https://julien.danjou.info/blog/ceilometer-gnocchi-aodh-liberty-progress/</guid><description>It&apos;s been a while since I talked about Ceilometer and its companions, so I thought I&apos;d go ahead and write a bit about what&apos;s going on this side of OpenStack. I&apos;m not going to cover new features and fa</description><pubDate>Tue, 04 Aug 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;It&apos;s been a while since I talked about Ceilometer and its companions, so I thought I&apos;d go ahead and write a bit about what&apos;s going on this side of OpenStack. I&apos;m not going to cover new features and fancy stuff today, but rather a shallow overview of the new project processes we initiated.&lt;/p&gt;
&lt;h2&gt;Ceilometer growing&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt; has grown a lot since that time when we started it 3 years ago. It has evolved from a system designed to fetch and store measurements, to a more complex system, with agents, alarms, events, databases, APIs, etc.&lt;/p&gt;
&lt;p&gt;All those features were needed and asked for by users and operators, but let&apos;s be honest, some of them should never have ended up in the Ceilometer code repository, especially not all at the same time.&lt;/p&gt;
&lt;p&gt;The reality is we picked a pragmatic approach due to the rigidity of the OpenStack Technical Committee in regards to new projects to become OpenStack integrated – and, therefore, blessed – projects. Ceilometer was actually the first project to be incubated and then integrated. We had to go through the very first issues of that process.&lt;/p&gt;
&lt;p&gt;Fortunately, now that time has passed, and all those constraints have been relaxed. To me, the &lt;a href=&quot;https://www.openstack.org/foundation&quot;&gt;OpenStack Foundation&lt;/a&gt; is turning into something that looks like the &lt;a href=&quot;http://www.apache.org/foundation/&quot;&gt;Apache Foundation&lt;/a&gt;, and there&apos;s, therefore, no need to tie technical solutions to political issues.&lt;/p&gt;
&lt;p&gt;Indeed, the &lt;a href=&quot;https://www.openstack.org/summit/vancouver-2015/summit-videos/presentation/the-big-tent-a-look-at-the-new-openstack-projects-governance&quot;&gt;Big Tent&lt;/a&gt; now allows much more flexibility to all of that. Back a year ago, we were afraid to bring Gnocchi into Ceilometer. Was the Technical Committee going to review the project? Was the project going to be in the scope of Ceilometer for the Technical Committee? Now we don&apos;t have to ask ourselves those questions, now that we have that freedom, it empowers us to actually do what we think is good in term of technical design without worrying too much about political issues.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/ceilometer-activity.png&quot; alt=&quot;ceilometer-activity&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Acknowledging Gnocchi&lt;/h2&gt;
&lt;p&gt;The first step in this new process was to continue working on &lt;a href=&quot;https://launchpad.net/gnocchi&quot;&gt;Gnocchi&lt;/a&gt; (a timeserie database and resource indexer designed to overcome historical Ceilometer storage issue) and to decide that it was not the right call to merge it into Ceilometer as some REST API v3, but that it was better to keep it standalone.&lt;/p&gt;
&lt;p&gt;We managed to get traction to Gnocchi, getting a few contributors and users. We&apos;re even seeing talks proposed to the next Tokyo Summit where people leverage Gnocchi, such as &quot;Service of predictive analytics on cost and performance in OpenStack&quot;, &quot;&lt;a href=&quot;https://wiki.openstack.org/wiki/Surveil&quot;&gt;Suveil&lt;/a&gt;&quot; and &quot;Cutting Edge NFV On OpenStack: Healing and Scaling Distributed Applications&quot;.&lt;/p&gt;
&lt;p&gt;We are also doing some progress on pushing Gnocchi outside of the OpenStack community, as it can be a self-sufficient timeserie and resource database that can be used without any OpenStack interaction.&lt;/p&gt;
&lt;h2&gt;Branching Aodh&lt;/h2&gt;
&lt;p&gt;Rather than continuing to grow Ceilometer, during the last summit we all decided that it was time to reorganize and split Ceilometer into the different components it is made of, leveraging a more &lt;a href=&quot;https://en.wikipedia.org/wiki/Service-oriented_architecture&quot;&gt;service-oriented architecture&lt;/a&gt;. The alarm subsystem of Ceilometer being mostly untied to the rest of Ceilometer, we decided it was the first and perfect candidate to do that. I personally engaged into doing the work and created a new repository with only the alarm code from Ceilometer, named &lt;a href=&quot;https://launchpad.net/aodh&quot;&gt;Aodh&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/woman-fire.jpg&quot; alt=&quot;woman-fire&quot; /&gt;&lt;/p&gt;
&lt;p&gt;This made sense for a lot of reason. First because Aodh can now work completely standalone, using either Ceilometer or Gnocchi as a backend – or any new plugin you&apos;d write. I love the idea that OpenStack projects can work standalone – like Swift does for example – without implying any other OpenStack component. I think it&apos;s a proof of good design. Secondly, because it allows us to resonate on a smaller chunk of software – a reason really under-estimated today in OpenStack. I believe that the size of your software should match a certain ratio to the size of your team.&lt;/p&gt;
&lt;p&gt;Aodh is, therefore, a new project under the OpenStack Telemetry program (or what remains of OpenStack programs now), alongside Ceilometer and Gnocchi, forked from the original Ceilometer alarm feature. We&apos;ll deprecate the latter with the Liberty release, and we&apos;ll remove it in the Mitaka release.&lt;/p&gt;
&lt;h2&gt;Lessons learned&lt;/h2&gt;
&lt;p&gt;Actually, moving that code out of Ceilometer (in the case of Aodh), or not merging it in (in the case of Gnocchi) had a few side effects that I admit I think we probably under-estimated back then.&lt;/p&gt;
&lt;p&gt;Indeed, the code size of Gnocchi or Aodh ended up being much smaller than the entire Ceilometer project – Gnocchi is 7× smaller and Aodh 5x smaller than Ceilometer – and therefore much more easy to manipulate and to hack on. That allowed us to merge dozens of patches in a few weeks, cleaning-up and enhancing a lot of small things in the code. Those tasks are very much harder in Ceilometer, due to the bigger size of the code base and the small size of our team. By having our small team working on smaller chunks of changes – even when it meant actually doing more reviews – greatly improved our general velocity and the number of bugs fixed and features implemented.&lt;/p&gt;
&lt;p&gt;On the more sociological side, I think it gave the team the sensation of finally owning the project. Ceilometer was huge, and it was impossible for people to know every side of it. Now, it&apos;s getting possible for people inside a team to cover a much larger portion of those smaller project, which gives them a greater sense of ownership and caring. Which ends up being good for the project quality overall.&lt;/p&gt;
&lt;p&gt;That also means that we technically decided to have different core teams by project (Ceilometer, Gnocchi, and Aodh) as they all serve different purposes and can all be used standalone or with each others. Meaning we could have contributors completely ignoring other projects.&lt;/p&gt;
&lt;p&gt;All of that reminds me some discussion I heard about projects such as Glance, trying to fit new features in - some that are really orthogonal to the original purpose. It&apos;s now clear to me that having different small components interacting together that can be completely owned and taken care of by a (small) team of contributors is the way to go. People that can therefore trust each others and easily bring new people in, makes a project really incredibly more powerful. Having a project covering a too wide set of features make things more difficult if you don&apos;t have enough manpower. This is clearly an issue that big projects inside OpenStack are facing now, such as Neutron or Nova.&lt;/p&gt;
</content:encoded><category>openstack</category><category>gnocchi</category></item><item><title>Timezones and Python</title><link>https://julien.danjou.info/blog/python-and-timezones/</link><guid isPermaLink="true">https://julien.danjou.info/blog/python-and-timezones/</guid><description>Recently, I&apos;ve been fighting with the never ending issue of timezones. I never thought I would have plunged into this rabbit hole, but hacking on OpenStack and Gnocchi I felt into that trap easily is,</description><pubDate>Tue, 16 Jun 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Recently, I&apos;ve been fighting with the never ending issue of timezones. I never thought I would have plunged into this rabbit hole, but hacking on OpenStack and Gnocchi I felt into that trap easily is, thanks to Python.&lt;/p&gt;
&lt;h2&gt;“Why you really, really, should never ever deal with timezones”&lt;/h2&gt;
&lt;p&gt;To get a glimpse of the complexity of timezones, I recommend that you watch &lt;a href=&quot;http://www.tomscott.com/&quot;&gt;Tom Scott&lt;/a&gt;&apos;s video on the subject. It&apos;s fun and it summarizes remarkably well the nightmare that timezones are and why you should stop thinking that you&apos;re smart.&lt;/p&gt;
&lt;h2&gt;The importance of timezones in applications&lt;/h2&gt;
&lt;p&gt;Once you&apos;ve heard what Tom says, I think it gets pretty clear that a timestamp without any timezone attached does not give any useful information. It should be considered irrelevant and useless. Without the necessary context given by the timezone, you cannot infer what point in time your application is really referring to.&lt;/p&gt;
&lt;p&gt;That means your application should never handle timestamps with no timezone information. It should try to guess or raises an error if no timezone is provided in any input.&lt;/p&gt;
&lt;p&gt;Of course, you can infer that having no timezone information means UTC. This sounds very handy, but can also be dangerous in certain applications or language – such as Python, as we&apos;ll see.&lt;/p&gt;
&lt;p&gt;Indeed, in certain applications, converting timestamps to UTC and losing the timezone information is a terrible idea. Imagine that a user create a recurring event every Wednesday at 10:00 in its local timezone, say CET. If you convert that to UTC, the event will end up being stored as every Wednesday at 09:00.&lt;/p&gt;
&lt;p&gt;Now imagine that the CET timezone switches from UTC+01:00 to UTC+02:00: your application will compute that the event starts at 11:00 CET every Wednesday. Which is wrong, because as the user told you, the event starts at 10:00 CET, whatever the definition of CET is. Not at 11:00 CET. So CET means CET, not necessarily UTC+1.&lt;/p&gt;
&lt;p&gt;As for endpoints like REST API, a thing I daily deal with, all timestamps should include a timezone information. It&apos;s nearly impossible to know what timezone the timestamps are in otherwise: UTC? Server local? User local? No way to know.&lt;/p&gt;
&lt;h2&gt;Python design &amp;amp; defect&lt;/h2&gt;
&lt;p&gt;Python comes with a timestamp object named &lt;code&gt;datetime.datetime&lt;/code&gt;. It can store date and time precise to the microsecond, and is qualified of timezone &quot;aware&quot; or &quot;unaware&quot;, whether it embeds a timezone information or not.&lt;/p&gt;
&lt;p&gt;To build such an object based on the current time, one can use &lt;code&gt;datetime.datetime.utcnow()&lt;/code&gt; to retrieve the date and time for the UTC timezone, and &lt;code&gt;datetime.datetime.now()&lt;/code&gt; to retrieve the date and time for the current timezone, whatever it is.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import datetime
&amp;gt;&amp;gt;&amp;gt; datetime.datetime.utcnow()
datetime.datetime(2015, 6, 15, 13, 24, 48, 27631)
&amp;gt;&amp;gt;&amp;gt; datetime.datetime.now()
datetime.datetime(2015, 6, 15, 15, 24, 52, 276161)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can notice, none of these results contains timezone information. Indeed, Python &lt;code&gt;datetime&lt;/code&gt; API always returns unaware &lt;code&gt;datetime&lt;/code&gt; objects, which is very unfortunate. Indeed, as soon as you get one of this object, there is no way to know what the timezone is, therefore these objects are pretty &quot;useless&quot; on their own.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://lucumr.pocoo.org/2011/7/15/eppur-si-muove/&quot;&gt;Armin Ronacher proposes that an application always consider that the unaware &lt;code&gt;datetime&lt;/code&gt; objects from Python are considered as UTC&lt;/a&gt;. As we just saw, that statement cannot be considered true for objects returned by &lt;code&gt;datetime.datetime.now()&lt;/code&gt;, so I would not advise doing so. &lt;code&gt;datetime&lt;/code&gt; objects with no timezone should be considered as a &quot;bug&quot; in the application.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/timezone-map.jpg&quot; alt=&quot;timezone-map&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Recommendations&lt;/h2&gt;
&lt;p&gt;My recommendation list comes down to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Always use aware &lt;code&gt;datetime&lt;/code&gt; object, i.e. with timezone information. That makes sure you can compare them directly (aware and unaware &lt;code&gt;datetime&lt;/code&gt; objects are not comparable) and will return them correctly to users. Leverage &lt;a href=&quot;http://pytz.sourceforge.net/&quot;&gt;pytz&lt;/a&gt; to have timezone objects.&lt;/li&gt;
&lt;li&gt;Use &lt;a href=&quot;https://en.wikipedia.org/wiki/ISO_8601&quot;&gt;ISO 8601&lt;/a&gt; as input and output string format. Use &lt;code&gt;datetime.datetime.isoformat()&lt;/code&gt; to return timestamps as string formatted using that format, which includes the timezone information.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In Python, that&apos;s equivalent to having:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import datetime
&amp;gt;&amp;gt;&amp;gt; import pytz
&amp;gt;&amp;gt;&amp;gt; def utcnow():
    return datetime.datetime.now(tz=pytz.utc)
&amp;gt;&amp;gt;&amp;gt; utcnow()
datetime.datetime(2015, 6, 15, 14, 45, 19, 182703, tzinfo=&amp;lt;UTC&amp;gt;)
&amp;gt;&amp;gt;&amp;gt; utcnow().isoformat()
&apos;2015-06-15T14:45:21.982600+00:00&apos;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you need to parse strings containing ISO 8601 formatted timestamp, you can rely on the &lt;em&gt;&lt;a href=&quot;https://pypi.python.org/pypi/iso8601&quot;&gt;iso8601&lt;/a&gt;&lt;/em&gt;, which returns timestamps with correct timezone information. This makes timestamps directly comparable:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import iso8601
&amp;gt;&amp;gt;&amp;gt; iso8601.parse_date(utcnow().isoformat())
datetime.datetime(2015, 6, 15, 14, 46, 43, 945813, tzinfo=&amp;lt;FixedOffset &apos;+00:00&apos; datetime.timedelta(0)&amp;gt;)
&amp;gt;&amp;gt;&amp;gt; iso8601.parse_date(utcnow().isoformat()) &amp;lt; utcnow()
True
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you need to store those timestamps, the same rule should apply. If you rely on &lt;a href=&quot;http://mongodb.org&quot;&gt;MongoDB&lt;/a&gt;, it assumes that all the timestamp are in UTC, so be careful when storing them – you will have to normalize the timestamp to UTC.&lt;/p&gt;
&lt;p&gt;For &lt;a href=&quot;http://mysql.org&quot;&gt;MySQL&lt;/a&gt;, nothing is assumed, it&apos;s up to the application to insert them in a timezone that makes sense to it. Obviously, if you have multiple applications accessing the same database with different data sources, this can end up being a nightmare.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://postgresql.org&quot;&gt;PostgreSQL&lt;/a&gt; has a &lt;a href=&quot;http://www.postgresql.org/docs/9.4/static/datatype-datetime.html&quot;&gt;special data type that is recommended&lt;/a&gt; called &lt;code&gt;timestamp with timezone&lt;/code&gt;. That does not mean you should not use UTC in most cases; that just means you are sure that the timestamp are stored in UTC since it&apos;s written in the database, and you check if any other application inserted timestamps with different timezone.&lt;/p&gt;
&lt;h2&gt;OpenStack status&lt;/h2&gt;
&lt;p&gt;As a side note, I&apos;ve improved OpenStack situation recently by changing the &lt;a href=&quot;http://docs.openstack.org/developer/oslo.utils/api/timeutils.html&quot;&gt;oslo.utils.timeutils&lt;/a&gt; module to deprecate some useless and dangerous functions. I&apos;ve also added support for returning timezone aware objects when using the &lt;code&gt;oslo_utils.timeutils.utcnow()&lt;/code&gt; function. It&apos;s not possible to make it a default unfortunately for backward compatibility reason, but it&apos;s there nevertheless, and it&apos;s advised to use it. Thanks to my colleague &lt;a href=&quot;http://haypo-notes.readthedocs.org/&quot;&gt;Victor&lt;/a&gt; for the help!&lt;/p&gt;
&lt;p&gt;Have a nice day, whatever your timezone is!&lt;/p&gt;
</content:encoded><category>python</category><category>openstack</category></item><item><title>OpenStack Summit Liberty from a Ceilometer &amp; Gnocchi point of view</title><link>https://julien.danjou.info/blog/openstack-summit-liberty-vancouver-ceilometer-gnocchi/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-summit-liberty-vancouver-ceilometer-gnocchi/</guid><description>Last week I was in Vancouver, BC for the OpenStack Summit, discussing the new Liberty version that will be released in 6 months.</description><pubDate>Tue, 26 May 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Last week I was in &lt;a href=&quot;http://vancouver.ca/&quot;&gt;Vancouver, BC&lt;/a&gt; for the &lt;a href=&quot;https://www.openstack.org/summit/vancouver-2015/&quot;&gt;OpenStack Summit&lt;/a&gt;, discussing the new Liberty version that will be released in 6 months.&lt;/p&gt;
&lt;p&gt;I&apos;ve attended the summit mainly to discuss and follow-up new developments on Ceilometer, Gnocchi and Oslo. It has been a pretty good week and we were able to discuss and plan a few interesting things.&lt;/p&gt;
&lt;h2&gt;Ops feedback&lt;/h2&gt;
&lt;p&gt;We had half a dozen Ceilometer sessions, and the first one was dedicated to getting feedbacks from operators using Ceilometer. We had a few operators present, and a few of the Ceilometer team. We had constructive discussion, and my feeling is that operators struggles with 2 things so far: scaling Ceilometer storage and having Ceilometer not killing the rest of OpenStack.&lt;/p&gt;
&lt;p&gt;We discussed the first point as being addressed by &lt;a href=&quot;http://launchpad.net/gnocchi&quot;&gt;Gnocchi&lt;/a&gt;, and I presented a bit Gnocchi itself, as well as how and why it will fix the storage scalability issue operators encountered so far.&lt;/p&gt;
&lt;p&gt;Ceilometer putting down the OpenStack installation is more interesting problem. Ceilometer pollsters request information from Nova, Glance… to gather statistics. Until Kilo, Ceilometer used to do that regularly and at fixed interval, causing high pike load in OpenStack. With the &lt;a href=&quot;http://docs.openstack.org/developer/ceilometer/architecture.html#polling-agents-asking-for-data&quot;&gt;introduction of jitter&lt;/a&gt; in Kilo, this should be less of a problem. However, Ceilometer hits various endpoints in OpenStack that are poorly designed, and hitting those endpoints of Nova or other components triggers a lot of load on the platform. Unfortunately, this makes operators blame Ceilometer rather than blaming the components being guilty of poor designs. We&apos;d like to push forward improving these components, but it&apos;s probably going to take a long time.&lt;/p&gt;
&lt;h2&gt;Componentisation&lt;/h2&gt;
&lt;p&gt;When I started the Gnocchi project last year, I pretty soon realized that we would be able to split Ceilometer itself in different smaller components that could work independently, while being able to leverage each others. For example, Gnocchi can run standalone and store your metrics even if you don&apos;t use Ceilometer – nor even OpenStack itself.&lt;/p&gt;
&lt;p&gt;My fellow developer &lt;a href=&quot;http://burningchrome.com/&quot;&gt;Chris Dent&lt;/a&gt; had the same idea about splitting Ceilometer a few months ago and drafted a proposal. The idea is to have Ceilometer split in different parts that people could assemble together or run on their owns.&lt;/p&gt;
&lt;p&gt;Interestingly enough, we had three 40 minutes sessions planned to talk and debate about this division of Ceilometer, though we all agreed in 5 minutes that this was the good thing to do. Five more minutes later, we agreed on which part to split. The rest of the time was allocated to discuss various details of that split, and I engaged to start doing the work with Ceilometer alarming subsystem.&lt;/p&gt;
&lt;p&gt;I wrote a &lt;a href=&quot;https://review.openstack.org/#/c/184307/&quot;&gt;specification&lt;/a&gt; on the plane bringing me to Vancouver, that should be approved pretty soon now. I already started doing the implementation work. So fingers crossed, Ceilometer should have a new components in Liberty handling alarming on its own.&lt;/p&gt;
&lt;p&gt;This would allow users for example to only deploys Gnocchi and Ceilometer alarm. They would be able to feed data to Gnocchi using their own system, and build alarms using Ceilometer alarm subsystem relying on Gnocchi&apos;s data.&lt;/p&gt;
&lt;h2&gt;Gnocchi&lt;/h2&gt;
&lt;p&gt;We didn&apos;t have a Gnocchi dedicated slot – mainly because I indicated I didn&apos;t feel we needed one. We anyway discussed a few points around coffee, and I&apos;ve been able to draw a few new ideas and changes I&apos;d like to see in Gnocchi. Mainly changing the API contract to be more asynchronously so we can support &lt;a href=&quot;http://influxdb.com/&quot;&gt;InfluxDB&lt;/a&gt; more correctly, and improve Carbonara (the library we created to manipulate timeseries) based drivers to be faster.&lt;/p&gt;
&lt;p&gt;All of those should – plus a few Oslo tasks I&apos;d like to tackle – should keep me busy for the next cycle!&lt;/p&gt;
</content:encoded><category>openstack</category><category>gnocchi</category></item><item><title>My interview about software tests and Python</title><link>https://julien.danjou.info/blog/interview-software-tests-in-python/</link><guid isPermaLink="true">https://julien.danjou.info/blog/interview-software-tests-in-python/</guid><description>Johannes Hubertz interviewed me for his upcoming German book about Python software testing, covering my work on OpenStack and testing best practices.</description><pubDate>Mon, 11 May 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I&apos;ve recently been contacted by &lt;a href=&quot;http://hubertz.de/blog/&quot;&gt;Johannes Hubertz&lt;/a&gt;, who is writing a new book about Python in German called &lt;em&gt;&quot;Softwaretests mit Python&quot;&lt;/em&gt; which will be published by &lt;em&gt;Open Source Press, Munich&lt;/em&gt; this summer. His book will feature some interviews, and he was kind enough to let me write a bit about software testing. This is the interview that I gave for his book. Johannes translated to German and it will be included in Johannes&apos; book, and I decided to publish it on my blog today. Following is the original version.&lt;/p&gt;
&lt;h2&gt;How did you come to Python?&lt;/h2&gt;
&lt;p&gt;I don&apos;t recall exactly, but around ten years ago, I saw more and more people using it and decided to take a look. Back then, I was more used to Perl. I didn&apos;t really like Perl and was not getting a good grip on its object system.&lt;/p&gt;
&lt;p&gt;As soon as I found an idea to work on – if I remember correctly that was rebuildd – I started to code in Python, learning the language at the same time.&lt;/p&gt;
&lt;p&gt;I liked how Python worked, and how fast I was to able to develop and learn it, so I decided to keep using it for my next projects. I ended up diving into Python core for some reasons, even doing things like briefly hacking on projects like Cython at some point, and finally ended up working on OpenStack.&lt;/p&gt;
&lt;p&gt;OpenStack is a cloud computing platform entirely written in Python. So I&apos;ve been writing Python every day since working on it.&lt;/p&gt;
&lt;p&gt;That&apos;s what pushed me to write &lt;a href=&quot;https://thehackerguidetopython.com&quot;&gt;The Hacker&apos;s Guide to Python&lt;/a&gt; in 2013 and then self-publish it a year later in 2014, a book where I talk about doing smart and efficient Python.&lt;/p&gt;
&lt;p&gt;It had a great success, has even been translated in Chinese and Korean, so I&apos;m currently working on a second edition of the book. It has been an amazing adventure!&lt;/p&gt;
&lt;h2&gt;Zen of Python: Which line is the most important for you and why?&lt;/h2&gt;
&lt;p&gt;I like the &quot;There should be one – and preferably only one – obvious way to do it&quot;. The opposite is probably something that scared me in languages like Perl. But having one obvious way to do it is and something I tend to like in functional languages like Lisp, which are in my humble opinion, even better at that.&lt;/p&gt;
&lt;h2&gt;For a python newbie, what are the most difficult subjects in Python?&lt;/h2&gt;
&lt;p&gt;I haven&apos;t been a newbie since a while, so it&apos;s hard for me to say. I don&apos;t think the language is hard to learn. There are some subtlety in the language itself when you deeply dive into the internals, but for beginners most of the concept are pretty straight-forward. If I had to pick, in the language basics, the most difficult thing would be around the generator objects (yield).&lt;/p&gt;
&lt;p&gt;Nowadays I think the most difficult subject for new comers is what version of Python to use, which libraries to rely on, and how to package and distribute projects. Though things get better, fortunately.&lt;/p&gt;
&lt;h2&gt;When did you start using Test Driven Development and why?&lt;/h2&gt;
&lt;p&gt;I learned unit testing and TDD at school where teachers forced me to learn Java, and I hated it. The frameworks looked complicated, and I had the impression I was losing my time. Which I actually was, since I was writing disposable programs – that&apos;s the only thing you do at school.&lt;/p&gt;
&lt;p&gt;Years later, when I started to write real and bigger programs (e.g. rebuildd), I quickly ended up fixing bugs… I already fixed. That recalled me about unit tests and that it may be a good idea to start using them to stop fixing the same things over and over again.&lt;/p&gt;
&lt;p&gt;For a few years, I wrote less Python and more C code and Lua (for the &lt;a href=&quot;http://awesome.naquadah.org&quot;&gt;awesome window manager&lt;/a&gt;), and I didn&apos;t use any testing. I probably lost hundreds of hours testing manually and fixing regressions – that was a good lesson. Though I had good excuses at that time – it is/was way harder to do testing in C/Lua than in Python.&lt;/p&gt;
&lt;p&gt;Since that period, I have never stopped writing &quot;tests&quot;. When I started to hack on OpenStack, the project was adopting a &quot;no test? no merge!&quot; policy due to the high number of regressions it had during the first releases.&lt;/p&gt;
&lt;p&gt;I honestly don&apos;t think I could work on any project that does not have – at least a minimal – test coverage. It&apos;s impossible to hack efficiently on a code base that you&apos;re not able to test in just a simple command. It&apos;s also a real problem for new comers in the open source world. When there are no test, you can hack something and send a patch, and get a &quot;you broke this&quot; in response.&lt;/p&gt;
&lt;p&gt;Nowadays, this kind of response sounds unacceptable to me: if there is no test, then I didn&apos;t break anything!&lt;/p&gt;
&lt;p&gt;In the end, it&apos;s just too much frustration to work on non tested projects as I demonstrated in &lt;a href=&quot;https://julien.danjou.info/blog/python-bad-practice-concrete-case&quot;&gt;my study of whisper source code&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;What do you think to be the most often seen pitfalls of TDD and how to avoid them best?&lt;/h2&gt;
&lt;p&gt;The biggest problems are when and at what rate writing tests.&lt;/p&gt;
&lt;p&gt;On one hand, some people starts to write too precise tests way too soon. Doing that slows you down, especially when you are prototyping some idea or concept you just had. That does not mean that you should not do test at all, but you should probably start with a light coverage, until you are pretty sure that you&apos;re not going to rip every thing and start over. On the other hand, some people postpone writing tests for ever, and end up with no test all or a too thin layer of test. Which makes the project with a pretty low coverage.&lt;/p&gt;
&lt;p&gt;Basically, your test coverage should reflect the state of your project. If it&apos;s just starting, you should build a thin layer of test so you can hack it on it easily and remodel it if needed. The more your project grow, the more you should make it sold and lay more tests.&lt;/p&gt;
&lt;p&gt;Having too detailed tests is painful to make the project evolve at the start. Having not enough in a big project makes it painful to maintain it.&lt;/p&gt;
&lt;h2&gt;Do you think, TDD fits and scales well for the big projects like OpenStack?&lt;/h2&gt;
&lt;p&gt;Not only I think it fits and scales well, but I also think it&apos;s just impossible to not use TDD in such big projects.&lt;/p&gt;
&lt;p&gt;When unit and functional tests coverage was weak in OpenStack – at its beginning – it was just impossible to fix a bug or write a new feature without breaking a lot of things without even noticing. We would release version N, and a ton of old bugs present in N-2 – but fixed in N-1 – were reopened.&lt;/p&gt;
&lt;p&gt;For big projects, with a lot of different use cases, configuration options, etc, you need belt and braces. You cannot throw code in a repository thinking it&apos;s going to work ever, and you can&apos;t afford to test everything manually at each commit. That&apos;s just insane.&lt;/p&gt;
</content:encoded><category>career</category><category>python</category><category>books</category><category>openstack</category></item><item><title>Gnocchi 1.0: storing metrics and resources at scale</title><link>https://julien.danjou.info/blog/openstack-gnocchi-first-release/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-gnocchi-first-release/</guid><description>A few months ago, I wrote a long post about what I called back then the &quot; Gnocchi experiment &quot;. Time passed and we – me and the rest of the Gnocchi team – continued to work on that project, finalizing</description><pubDate>Tue, 21 Apr 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A few months ago, I wrote a long post about what I called back then the &quot;&lt;a href=&quot;https://julien.danjou.info/blog/openstack-ceilometer-the-gnocchi-experiment&quot;&gt;Gnocchi experiment&lt;/a&gt;&quot;. Time passed and we – me and the rest of the Gnocchi team – continued to work on that project, finalizing it.&lt;/p&gt;
&lt;p&gt;It&apos;s with a great pleasure that we are going to release our first &lt;em&gt;1.0&lt;/em&gt; version this month, roughly at the same time that the integrated &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; projects release their Kilo milestone. The &lt;a href=&quot;https://pypi.python.org/pypi/gnocchi&quot;&gt;first release candidate numbered 1.0.0rc1&lt;/a&gt; has been released this morning!&lt;/p&gt;
&lt;h2&gt;The problem to solve&lt;/h2&gt;
&lt;p&gt;Before I dive into Gnocchi details, it&apos;s important to have a good view of what problems Gnocchi is trying to solve.&lt;/p&gt;
&lt;p&gt;Most of the IT infrastructures out there consists of a set of resources. These resources have properties: some of them are simple attributes whereas others might be measurable quantities (also known as metrics).&lt;/p&gt;
&lt;p&gt;And in this context, the cloud infrastructures make no exception. We talk about instances, volumes, networks… which are all different kind of resources. The problems that are arising with the cloud trend is the scalability of storing all this data and being able to request them later, for whatever usage.&lt;/p&gt;
&lt;p&gt;What Gnocchi provides is a REST API that allows the user to manipulate resources (CRUD) and their attributes, while preserving the history of those resources and their attributes.&lt;/p&gt;
&lt;p&gt;Gnocchi is fully documented and the &lt;a href=&quot;http://gnocchi.xyz&quot;&gt;documentation is available online&lt;/a&gt;. We are the first OpenStack project to require patches to &lt;em&gt;integrate the documentation&lt;/em&gt;. We want to raise the bar, so we took a stand on that. That&apos;s part of our policy, the same way it&apos;s part of the OpenStack policy to require unit tests.&lt;/p&gt;
&lt;p&gt;I&apos;m not going to paraphrase the whole Gnocchi documentation, which covers things like installation (super easy), but I&apos;ll guide you through some basics of the features provided by the REST API. I will show you some example so you can have a better understanding of what you could leverage using Gnocchi!&lt;/p&gt;
&lt;h2&gt;Handling metrics&lt;/h2&gt;
&lt;p&gt;Gnocchi provides a full REST API to manipulate time-series that are called &lt;em&gt;metrics&lt;/em&gt;. You can easily create a metric using a simple HTTP request:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /v1/metric HTTP/1.1
Content-Type: application/json

{
  &quot;archive_policy_name&quot;: &quot;low&quot;
}

HTTP/1.1 201 Created
Location: http://localhost/v1/metric/387101dc-e4b1-4602-8f40-e7be9f0ed46a
Content-Type: application/json; charset=UTF-8

{
  &quot;archive_policy&quot;: {
    &quot;aggregation_methods&quot;: [
      &quot;std&quot;,
      &quot;sum&quot;,
      &quot;mean&quot;,
      &quot;count&quot;,
      &quot;max&quot;,
      &quot;median&quot;,
      &quot;min&quot;,
      &quot;95pct&quot;
    ],
    &quot;back_window&quot;: 0,
    &quot;definition&quot;: [
      {
        &quot;granularity&quot;: &quot;0:00:01&quot;,
        &quot;points&quot;: 3600,
        &quot;timespan&quot;: &quot;1:00:00&quot;
      },
      {
        &quot;granularity&quot;: &quot;0:30:00&quot;,
        &quot;points&quot;: 48,
        &quot;timespan&quot;: &quot;1 day, 0:00:00&quot;
      }
    ],
    &quot;name&quot;: &quot;low&quot;
  },
  &quot;created_by_project_id&quot;: &quot;e8afeeb3-4ae6-4888-96f8-2fae69d24c01&quot;,
  &quot;created_by_user_id&quot;: &quot;c10829c6-48e2-4d14-ac2b-bfba3b17216a&quot;,
  &quot;id&quot;: &quot;387101dc-e4b1-4602-8f40-e7be9f0ed46a&quot;,
  &quot;name&quot;: null,
  &quot;resource_id&quot;: null
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;archive_policy_name&lt;/code&gt; parameter defines how the measures that are being sent are going to be aggregated. You can also define archive policies using the API and specify what kind of aggregation period and granularity you want. In that case , the &lt;em&gt;low&lt;/em&gt; archive policy keeps 1 hour of data aggregated over 1 second and 1 day of data aggregated to 30 minutes. The functions used for aggregations are the mathematical functions standard deviation, minimum, maximum, … and even 95th percentile. All of that is obviously customizable and you can create your own archive policies.&lt;/p&gt;
&lt;p&gt;If you don&apos;t want to specify the archive policy manually for each metric, you can also create &lt;em&gt;archive policy rule&lt;/em&gt;, that will apply a specific archive policy based on the metric name, e.g. metrics matching &lt;code&gt;disk.*&lt;/code&gt; will be high resolution metrics so they will use the &lt;code&gt;high&lt;/code&gt; archive policy.&lt;/p&gt;
&lt;p&gt;It&apos;s also worth noting Gnocchi is precise up to the nanosecond and is not tied to the current time. You can manipulate and inject measures that are years old and precise to the nanosecond. You can also inject points with old timestamps (i.e. old compared to the most recent one in the timeseries) with an archive policy allowing it (see &lt;code&gt;back_window&lt;/code&gt; parameter).&lt;/p&gt;
&lt;p&gt;It&apos;s then possible to send measures to this metric:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /v1/metric/387101dc-e4b1-4602-8f40-e7be9f0ed46a/measures HTTP/1.1
Content-Type: application/json

[
  {
    &quot;timestamp&quot;: &quot;2014-10-06T14:33:57&quot;,
    &quot;value&quot;: 43.1
  },
  {
    &quot;timestamp&quot;: &quot;2014-10-06T14:34:12&quot;,
    &quot;value&quot;: 12
  },
  {
    &quot;timestamp&quot;: &quot;2014-10-06T14:34:20&quot;,
    &quot;value&quot;: 2
  }
  ]
  
HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;These measures are synchronously aggregated and stored into the configured storage backend. Our most scalable storage drivers for now are either based on &lt;a href=&quot;http://launchpad.net/swift&quot;&gt;Swift&lt;/a&gt; or &lt;a href=&quot;http://ceph.com&quot;&gt;Ceph&lt;/a&gt; which are both scalable storage objects systems.&lt;/p&gt;
&lt;p&gt;It&apos;s then possible to retrieve these values:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /v1/metric/387101dc-e4b1-4602-8f40-e7be9f0ed46a/measures HTTP/1.1

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8

[
  [
    &quot;2014-10-06T14:30:00.000000Z&quot;,
    1800.0,
    19.033333333333335
  ],
  [
    &quot;2014-10-06T14:33:57.000000Z&quot;,
    1.0,
    43.1
  ],
  [
    &quot;2014-10-06T14:34:12.000000Z&quot;,
    1.0,
    12.0
  ],
  [
    &quot;2014-10-06T14:34:20.000000Z&quot;,
    1.0,
    2.0
  ]
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As older Ceilometer users might notice here, metrics are only storing points and values, nothing fancy such as metadata anymore.&lt;/p&gt;
&lt;p&gt;By default, values eagerly aggregated using mean are returned for all supported granularities. You can obviously specify a time range or a different aggregation function using the &lt;code&gt;aggregation&lt;/code&gt;, &lt;code&gt;start&lt;/code&gt; and &lt;code&gt;stop&lt;/code&gt; query parameter.&lt;/p&gt;
&lt;p&gt;Gnocchi also supports doing aggregation across aggregated metrics:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /v1/aggregation/metric?metric=65071775-52a8-4d2e-abb3-1377c2fe5c55&amp;amp;metric=9ccdd0d6-f56a-4bba-93dc-154980b6e69a&amp;amp;start=2014-10-06T14:34&amp;amp;aggregation=mean HTTP/1.1

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8

[
  [
    &quot;2014-10-06T14:34:12.000000Z&quot;,
    1.0,
    12.25
  ],
  [
    &quot;2014-10-06T14:34:20.000000Z&quot;,
    1.0,
    11.6
  ]
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This computes the mean of mean for the metric &lt;code&gt;65071775-52a8-4d2e-abb3-1377c2fe5c55&lt;/code&gt; and &lt;code&gt;9ccdd0d6-f56a-4bba-93dc-154980b6e69a&lt;/code&gt; starting on 6th October 2014 at 14:34 UTC.&lt;/p&gt;
&lt;h2&gt;Indexing your resources&lt;/h2&gt;
&lt;p&gt;Another object and concept that Gnocchi provides is the ability to manipulate resources. There is a basic type of resource, called &lt;em&gt;generic&lt;/em&gt;, which has very few attributes. You can extend this type to specialize it, and that&apos;s what Gnocchi does by default by providing resource types known for OpenStack such as &lt;em&gt;instance&lt;/em&gt;, &lt;em&gt;volume&lt;/em&gt;, &lt;em&gt;network&lt;/em&gt; or even &lt;em&gt;image&lt;/em&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /v1/resource/generic HTTP/1.1

Content-Type: application/json

{
  &quot;id&quot;: &quot;75C44741-CC60-4033-804E-2D3098C7D2E9&quot;,
  &quot;project_id&quot;: &quot;BD3A1E52-1C62-44CB-BF04-660BD88CD74D&quot;,
  &quot;user_id&quot;: &quot;BD3A1E52-1C62-44CB-BF04-660BD88CD74D&quot;
}

HTTP/1.1 201 Created
Location: http://localhost/v1/resource/generic/75c44741-cc60-4033-804e-2d3098c7d2e9
ETag: &quot;e3acd0681d73d85bfb8d180a7ecac75fce45a0dd&quot;
Last-Modified: Fri, 17 Apr 2015 11:18:48 GMT
Content-Type: application/json; charset=UTF-8

{
  &quot;created_by_project_id&quot;: &quot;ec181da1-25dd-4a55-aa18-109b19e7df3a&quot;,
  &quot;created_by_user_id&quot;: &quot;4543aa2a-6ebf-4edd-9ee0-f81abe6bb742&quot;,
  &quot;ended_at&quot;: null,
  &quot;id&quot;: &quot;75c44741-cc60-4033-804e-2d3098c7d2e9&quot;,
  &quot;metrics&quot;: {},
  &quot;project_id&quot;: &quot;bd3a1e52-1c62-44cb-bf04-660bd88cd74d&quot;,
  &quot;revision_end&quot;: null,
  &quot;revision_start&quot;: &quot;2015-04-17T11:18:48.696288Z&quot;,
  &quot;started_at&quot;: &quot;2015-04-17T11:18:48.696275Z&quot;,
  &quot;type&quot;: &quot;generic&quot;,
  &quot;user_id&quot;: &quot;bd3a1e52-1c62-44cb-bf04-660bd88cd74d&quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The resource is created with the UUID provided by the user. Gnocchi handles the history of the resource, and that&apos;s what the &lt;code&gt;revision_start&lt;/code&gt; and &lt;code&gt;revision_end&lt;/code&gt; fields are for. They indicates the lifetime of this revision of the resource. The &lt;code&gt;ETag&lt;/code&gt; and &lt;code&gt;Last-Modified&lt;/code&gt; headers are also unique to this resource revision and can be used in a subsequent request using &lt;code&gt;If-Match&lt;/code&gt; or &lt;code&gt;If-Not-Match&lt;/code&gt; header, for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /v1/resource/generic/75c44741-cc60-4033-804e-2d3098c7d2e9 HTTP/1.1
If-Not-Match: &quot;e3acd0681d73d85bfb8d180a7ecac75fce45a0dd&quot;

HTTP/1.1 304 Not Modified
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which is useful to synchronize and update any view of the resources you might have in your application.&lt;/p&gt;
&lt;p&gt;You can use the &lt;code&gt;PATCH&lt;/code&gt; HTTP method to modify properties of the resource, which will create a new revision of the resource. The history of the resources are available via the REST API obviously.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;metrics&lt;/code&gt; properties of the resource allow you to link metrics to a resource. You can link existing metrics or create new ones dynamically:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /v1/resource/generic HTTP/1.1
Content-Type: application/json

{
  &quot;id&quot;: &quot;AB68DA77-FA82-4E67-ABA9-270C5A98CBCB&quot;,
  &quot;metrics&quot;: {
    &quot;temperature&quot;: {
      &quot;archive_policy_name&quot;: &quot;low&quot;
    }
  },
  &quot;project_id&quot;: &quot;BD3A1E52-1C62-44CB-BF04-660BD88CD74D&quot;,
  &quot;user_id&quot;: &quot;BD3A1E52-1C62-44CB-BF04-660BD88CD74D&quot;
}

HTTP/1.1 201 Created
Location: http://localhost/v1/resource/generic/ab68da77-fa82-4e67-aba9-270c5a98cbcb
ETag: &quot;9f64c8890989565514eb50c5517ff01816d12ff6&quot;
Last-Modified: Fri, 17 Apr 2015 14:39:22 GMT
Content-Type: application/json; charset=UTF-8

{
  &quot;created_by_project_id&quot;: &quot;cfa2ebb5-bbf9-448f-8b65-2087fbecf6ad&quot;,
  &quot;created_by_user_id&quot;: &quot;6aadfc0a-da22-4e69-b614-4e1699d9e8eb&quot;,
  &quot;ended_at&quot;: null,
  &quot;id&quot;: &quot;ab68da77-fa82-4e67-aba9-270c5a98cbcb&quot;,
  &quot;metrics&quot;: {
    &quot;temperature&quot;: &quot;ad53cf29-6d23-48c5-87c1-f3bf5e8bb4a0&quot;
  },
  &quot;project_id&quot;: &quot;bd3a1e52-1c62-44cb-bf04-660bd88cd74d&quot;,
  &quot;revision_end&quot;: null,
  &quot;revision_start&quot;: &quot;2015-04-17T14:39:22.181615Z&quot;,
  &quot;started_at&quot;: &quot;2015-04-17T14:39:22.181601Z&quot;,
  &quot;type&quot;: &quot;generic&quot;,
  &quot;user_id&quot;: &quot;bd3a1e52-1c62-44cb-bf04-660bd88cd74d&quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Haystack, needle? Find!&lt;/h2&gt;
&lt;p&gt;With such a system, it becomes very easy to index all your resources, meter them and retrieve this data. What&apos;s even more interesting is to query the system to find and list the resources you are interested in!&lt;/p&gt;
&lt;p&gt;You can search for a resource based on any field, for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json

{
  &quot;=&quot;: {
    &quot;user_id&quot;: &quot;bd3a1e52-1c62-44cb-bf04-660bd88cd74d&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That query will return a list of all resources owned by the &lt;code&gt;user_id&lt;/code&gt; &lt;code&gt;bd3a1e52-1c62-44cb-bf04-660bd88cd74d&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can do fancier queries such as retrieving all the instances started by a user this month:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json
Content-Length: 113

{
  &quot;and&quot;: [
    {
      &quot;=&quot;: {
        &quot;user_id&quot;: &quot;bd3a1e52-1c62-44cb-bf04-660bd88cd74d&quot;
      }
    },
    {
      &quot;&amp;gt;=&quot;: {
        &quot;started_at&quot;: &quot;2015-04-01&quot;
      }
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And you can even do fancier queries than the fancier ones (still following?). What if we wanted to retrieve all the instances that were on host &lt;code&gt;foobar&lt;/code&gt; the 15th April and who had already 30 minutes of uptime? Let&apos;s ask Gnocchi to look in the history!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /v1/search/resource/instance?history=true HTTP/1.1
Content-Type: application/json
Content-Length: 113

{
  &quot;and&quot;: [
    {
      &quot;=&quot;: {
        &quot;host&quot;: &quot;foobar&quot;
      }
    },
    {
      &quot;&amp;gt;=&quot;: {
        &quot;lifespan&quot;: &quot;1 hour&quot;
      }
    },
    {
      &quot;&amp;lt;=&quot;: {
        &quot;revision_start&quot;: &quot;2015-04-15&quot;
      }
    }

  ]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I could also mention the fact that you can &lt;a href=&quot;http://docs.openstack.org/developer/gnocchi/rest.html#searching-for-values-in-metrics&quot;&gt;search for value in metrics&lt;/a&gt;.&lt;br /&gt;
One feature that I will very likely include in Gnocchi 1.1 is the ability to search for resource whose specific metrics matches some value. For example, having the ability to search for instances whose CPU consumption was over 80% during a month.&lt;/p&gt;
&lt;h2&gt;Cherries on the cake&lt;/h2&gt;
&lt;p&gt;While Gnocchi is well integrated and based on common OpenStack technology, please do note that it is completely able to function without any other OpenStack component and is pretty straight-forward to deploy.&lt;/p&gt;
&lt;p&gt;Gnocchi also implements a full RBAC system based on the &lt;a href=&quot;http://docs.openstack.org/developer/oslo.policy/&quot;&gt;OpenStack standard oslo.policy&lt;/a&gt; and which allows pretty fine grained control of permissions.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi-resource-html.png&quot; alt=&quot;gnocchi-resource-html&quot; /&gt;&lt;/p&gt;
&lt;p&gt;There is also some work ongoing to have HTML rendering when browsing the API using a Web browser. While still simple, we&apos;d like to have a minimal Web interface served on top of the API for the same price!&lt;/p&gt;
&lt;p&gt;Ceilometer alarm subsystem supports Gnocchi with the Kilo release, meaning you can use it to trigger actions when a metric value crosses some threshold. And OpenStack &lt;a href=&quot;http://launchpad.net/heat&quot;&gt;Heat&lt;/a&gt; also supports auto-scaling your instances based on Ceilometer+Gnocchi alarms.&lt;/p&gt;
&lt;p&gt;And there are a few more API calls that I didn&apos;t talk about here, so don&apos;t hesitate to take a peek at the &lt;a href=&quot;http://gnocchi.xyz&quot;&gt;full documentation&lt;/a&gt;!&lt;/p&gt;
&lt;h2&gt;Towards Gnocchi 1.1!&lt;/h2&gt;
&lt;p&gt;Gnocchi is a different beast in the OpenStack community. It is under the umbrella of the Ceilometer program, but it&apos;s one of the first projects that is not part of the (old) integrated release. Therefore we decided to have a release schedule not directly linked to the OpenStack and we&apos;ll release more often that the rest of the old OpenStack components – probably once every 2 months or the like.&lt;/p&gt;
&lt;p&gt;What&apos;s coming next is a close integration with Ceilometer (e.g. moving the dispatcher code from Gnocchi to Ceilometer) and probably more features as we have more requests from our users. We are also exploring different backends such as InfluxDB (storage) or MongoDB (indexer).&lt;/p&gt;
&lt;p&gt;Stay tuned, and happy hacking!&lt;/p&gt;
</content:encoded><category>gnocchi</category><category>openstack</category></item><item><title>Distributed group management and locking in Python with tooz</title><link>https://julien.danjou.info/blog/python-distributed-membership-lock-with-tooz/</link><guid isPermaLink="true">https://julien.danjou.info/blog/python-distributed-membership-lock-with-tooz/</guid><description>With OpenStack embracing the Tooz library more and more over the past year, I think it&apos;s a good start to write a bit about it.</description><pubDate>Fri, 21 Nov 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;With &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; embracing the &lt;a href=&quot;http://launchpad.net/python-tooz&quot;&gt;Tooz&lt;/a&gt; library more and more over the past year, I think it&apos;s a good start to write a bit about it.&lt;/p&gt;
&lt;h2&gt;A bit of history&lt;/h2&gt;
&lt;p&gt;A little more than year ago, with my colleague Yassine Lamgarchal and others at &lt;a href=&quot;http://enovance.com&quot;&gt;eNovance&lt;/a&gt;, we investigated on how to solve a problem often encountered inside OpenStack: synchronization of multiple distributed workers. And while many people in our ecosystem continue to drive development by adding new bells and whistles, we made a point of solving new problems with a generic solution able to address the technical debt at the same time.&lt;/p&gt;
&lt;p&gt;Yassine wrote the first ideas of what should be the &lt;a href=&quot;https://wiki.openstack.org/wiki/Oslo/blueprints/service-sync&quot;&gt;group membership service&lt;/a&gt; that was needed for OpenStack, identifying several projects that could make use of this. I&apos;ve presented this concept during the &lt;a href=&quot;https://www.openstack.org/summit/openstack-summit-hong-kong-2013/&quot;&gt;OpenStack Summit in Hong-Kong&lt;/a&gt; during an Oslo session. It turned out that the idea was well-received, and the week following the summit we started the &lt;a href=&quot;http://launchpad.net/python-tooz&quot;&gt;tooz&lt;/a&gt; project on &lt;a href=&quot;http://ci.openstack.org/stackforge.html&quot;&gt;StackForge&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Goals&lt;/h2&gt;
&lt;p&gt;Tooz is a Python library that provides a coordination API. Its primary goal is to handle groups and membership of these groups in distributed systems.&lt;/p&gt;
&lt;p&gt;Tooz also provides another useful feature which is distributed locking. This allows distributed nodes to acquire and release locks in order to synchronize themselves (for example to access a shared resource).&lt;/p&gt;
&lt;h2&gt;The architecture&lt;/h2&gt;
&lt;p&gt;If you are familiar with distributed systems, you might be thinking that there are a lot of solutions already available to solve these issues: &lt;a href=&quot;http://zookeeper.apache.org/&quot;&gt;ZooKeeper&lt;/a&gt;, the &lt;a href=&quot;http://raftconsensus.github.io/&quot;&gt;Raft consensus algorithm&lt;/a&gt; or even &lt;a href=&quot;http://redis.io/&quot;&gt;Redis&lt;/a&gt; for example.&lt;/p&gt;
&lt;p&gt;You&apos;ll be thrilled to learn that Tooz is not the result of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Not_invented_here&quot;&gt;NIH&lt;/a&gt; syndrome, but is an abstraction layer on top of all these solutions. It uses drivers to provide the real functionalities behind, and does not try to do anything fancy.&lt;/p&gt;
&lt;p&gt;All the drivers do not have the same amount of functionality of robustness, but depending on your environment, any available driver might be suffice. Like most of OpenStack, we let the deployers/operators/developers chose whichever backend they want to use, informing them of the potential trade-offs they will make.&lt;/p&gt;
&lt;p&gt;So far, Tooz provides drivers based on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://pypi.python.org/pypi/kazoo&quot;&gt;Kazoo&lt;/a&gt; (ZooKeeper)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://pypi.python.org/pypi/zake&quot;&gt;Zake&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://memcached.org&quot;&gt;memcached&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://redis.io&quot;&gt;redis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.tldp.org/LDP/lpg/node21.html&quot;&gt;SysV IPC&lt;/a&gt; (only for distributed locks for now)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://postgresql.org&quot;&gt;PostgreSQL&lt;/a&gt; (only for distributed locks for now)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mysql.org&quot;&gt;MySQL&lt;/a&gt; (only for distributed locks for now)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All drivers are distributed across processes. Some can be distributed across the network (ZooKeeper, memcached, redis…) and some are only available on the same host (IPC).&lt;/p&gt;
&lt;p&gt;Also note that the Tooz API is completely asynchronous, allowing it to be more efficient, and potentially included in an event loop.&lt;/p&gt;
&lt;h2&gt;Features&lt;/h2&gt;
&lt;h3&gt;Group membership&lt;/h3&gt;
&lt;p&gt;Tooz provides an API to manage group membership. The basic operations provided are: the creation of a group, the ability to join it, leave it and list its members. It&apos;s also possible to be notified as soon as a member joins or leaves a group.&lt;/p&gt;
&lt;h3&gt;Leader election&lt;/h3&gt;
&lt;p&gt;Each group can have a leader elected. Each member can decide if it wants to run for the election. If the leader disappears, another one is elected from the list of current candidates. It&apos;s possible to be notified of the election result and to retrieve the leader of a group at any moment.&lt;/p&gt;
&lt;h3&gt;Distributed locking&lt;/h3&gt;
&lt;p&gt;When trying to synchronize several workers in a distributed environment, you may need a way to lock access to some resources. That&apos;s what a distributed lock can help you with.&lt;/p&gt;
&lt;h2&gt;Adoption in OpenStack&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt; is the first project in OpenStack to use Tooz. It has replaced part of the old alarm distribution system, where RPC was used to detect active alarm evaluator workers. The group membership feature of Tooz was leveraged by Ceilometer to coordinate between alarm evaluator workers.&lt;/p&gt;
&lt;p&gt;Another new feature part of the Juno release of Ceilometer is the distribution of polling tasks of the central agent among multiple workers. There&apos;s again a group membership issue to know which nodes are online and available to receive polling tasks, so Tooz is also being used here.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://wiki.openstack.org/Oslo&quot;&gt;Oslo&lt;/a&gt; team &lt;a href=&quot;https://review.openstack.org/#/c/122439/&quot;&gt;has accepted the adoption of Tooz&lt;/a&gt; during this release cycle. That means that it will be maintained by more developers, and will be part of the OpenStack release process.&lt;/p&gt;
&lt;p&gt;This opens the door to push Tooz further in OpenStack. Our next candidate would be write a service group driver for &lt;a href=&quot;http://launchpad.net/nova&quot;&gt;Nova&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://tooz.rtfd.org/&quot;&gt;complete documentation for Tooz is available online&lt;/a&gt; and has examples for the various features described here, go read it if you&apos;re curious and adventurous!&lt;/p&gt;
</content:encoded><category>python</category><category>openstack</category></item><item><title>Tracking OpenStack contributions in GitHub</title><link>https://julien.danjou.info/blog/tracking-openstack-contributions-in-github/</link><guid isPermaLink="true">https://julien.danjou.info/blog/tracking-openstack-contributions-in-github/</guid><description>I&apos;ve switched my Git repositories to GitHub recently, and started to watch my contributions statistics, which were very low considering I spend my days hacking on open source software, especially.</description><pubDate>Tue, 19 Aug 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I&apos;ve switched my Git repositories to &lt;a href=&quot;https://github.com&quot;&gt;GitHub&lt;/a&gt; recently, and started to watch my contributions statistics, which were very low considering I spend my days hacking on open source software, especially &lt;a href=&quot;https://openstack.org&quot;&gt;OpenStack&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/octocat-on-openstack-2.png&quot; alt=&quot;octocat-on-openstack-2&quot; /&gt;&lt;/p&gt;
&lt;p&gt;OpenStack hosts its Git repositories on its own infrastructure at &lt;a href=&quot;http://git.openstack.org&quot;&gt;git.openstack.org&lt;/a&gt;, but also mirrors them on GitHub. Logically, I was expecting GitHub to track my commits there too, as I&apos;m using the same email address everywhere.&lt;/p&gt;
&lt;p&gt;It turns out that it was not the case, and the &lt;a href=&quot;https://help.github.com/articles/why-are-my-contributions-not-showing-up-on-my-profile&quot;&gt;help page about that&lt;/a&gt; on GitHub describes the rule in place to compute statistics. Indeed, according to GitHub, I had no relations to the OpenStack repositories, as I never forked them nor opened a pull request on them (OpenStack uses &lt;a href=&quot;http://review.openstack.org&quot;&gt;Gerrit&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Starring a repository is enough to build a relationship between a user and a repository, so this is was the only thing needed to inform GitHub that I have contributed to those repositories. Considering OpenStack has hundreds of repositories, I decided to star them all by using a small Python script using &lt;a href=&quot;https://pypi.python.org/pypi/pygithub&quot;&gt;pygithub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And voilà, &lt;a href=&quot;https://github.com/jd&quot;&gt;my statistics&lt;/a&gt; are now including all my contributions to OpenStack!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/github-openstack-stats.png&quot; alt=&quot;github-openstack-stats&quot; /&gt;&lt;/p&gt;
</content:encoded><category>openstack</category><category>github</category></item><item><title>OpenStack Ceilometer and the Gnocchi experiment</title><link>https://julien.danjou.info/blog/openstack-ceilometer-the-gnocchi-experiment/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-ceilometer-the-gnocchi-experiment/</guid><description>A little more than 2 years ago, the Ceilometer project was launched inside the OpenStack ecosystem. Its main objective was to measure OpenStack cloud platforms in order to provide data and mechanisms.</description><pubDate>Mon, 18 Aug 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A little more than 2 years ago, the &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt; project was launched inside the OpenStack ecosystem. Its main objective was to measure OpenStack cloud platforms in order to provide data and mechanisms for functionalities such as billing, alarming or capacity planning.&lt;/p&gt;
&lt;p&gt;In this article, I would like to relate what I&apos;ve been doing with other Ceilometer developers in the last 5 months. I&apos;ve lowered my involvement in Ceilometer itself directly to concentrate on solving one of its biggest issue at the source, and I think it&apos;s largely time to take a break and talk about it.&lt;/p&gt;
&lt;h2&gt;Ceilometer early design&lt;/h2&gt;
&lt;p&gt;For the last years, Ceilometer didn&apos;t change in its core architecture. Without diving too much in all its parts, one of the early design decision was to build the metering around a data structure we called &lt;strong&gt;samples&lt;/strong&gt;. A sample is generated each time Ceilometer measures something. It is composed of a few fields, such as the the resource id that is metered, the user and project id owning that resources, the meter name, the measured value, a timestamp and a few free-form metadata. Each time Ceilometer measures something, one of its components (an agent, a pollster…) constructs and emits a sample headed for the storage component that we call the &lt;strong&gt;collector&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This collector is responsible for storing the samples into a database. The Ceilometer collector uses a pluggable storage system, meaning that you can pick any database system you prefer. Our original implementation has been based on MongoDB from the beginning, but we then added a SQL driver, and people contributed things such as HBase or DB2 support.&lt;/p&gt;
&lt;p&gt;The REST API exposed by Ceilometer allows to execute various reading requests on this data store. It can returns you the list of resources that have been measured for a particular project, or compute some statistics on metrics. Allowing such a large panel of possibilities and having such a flexible data structure allows to do a lot of different things with Ceilometer, as you can almost query the data in any mean you want.&lt;/p&gt;
&lt;h2&gt;The scalability issue&lt;/h2&gt;
&lt;p&gt;We soon started to encounter scalability issues in many of the read requests made via the REST API. A lot of the requests requires the data storage to do full scans of all the stored samples. Indeed, the fact that the API allows you to filter on any fields and also on the free-form metadata (meaning non indexed key/values tuples) has a terrible cost in terms of performance (as pointed before, the metadata are attached to each &lt;em&gt;sample&lt;/em&gt; generated by Ceilometer and is stored as is). That basically means that the &lt;em&gt;sample&lt;/em&gt; data structure is stored in most drivers in just one table or collection, in order to be able to scan them at once, and there&apos;s no good &quot;perfect&quot; sharding solution, making data storage scalability painful.&lt;/p&gt;
&lt;p&gt;It turns out that the Ceilometer REST API is unable to handle most of the requests in a timely manner as most operations are &lt;em&gt;O(n)&lt;/em&gt; where &lt;em&gt;n&lt;/em&gt; is the number of samples recorded (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Big_O_notation&quot;&gt;big O notation&lt;/a&gt; if you&apos;re unfamiliar with it). That number of samples can grow very rapidly in an environment of thousands of metered nodes and with a data retention of several weeks. There is a few optimizations to make things smoother in general cases fortunately, but as soon as you run specific queries, the API gets barely usable.&lt;/p&gt;
&lt;p&gt;During this last year, as the Ceilometer PTL, I discovered these issues first hand since a lot of people were feeding me back with this kind of testimony. We engaged several blueprints to improve the situation, but it was soon clear to me that this was not going to be enough anyway.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/unacceptable.jpg&quot; alt=&quot;unacceptable&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Thinking outside the box&lt;/h2&gt;
&lt;p&gt;Unfortunately, the PTL job doesn&apos;t leave him enough time to work on the actual code nor to play with anything new. I was coping with most of the project bureaucracy and I wasn&apos;t able to work on any good solution to tackle the issue at its root. Still, I had a few ideas that I wanted to try and as soon as I stepped down from the PTL role, I stopped working on Ceilometer itself to try something new and to think a bit outside the box.&lt;/p&gt;
&lt;p&gt;When one takes a look at what have been brought recently in Ceilometer, they can see the idea that Ceilometer actually needs to handle 2 types of data: events and metrics.&lt;/p&gt;
&lt;p&gt;Events are data generated when something happens: an instance start, a volume is attached, or an HTTP request is sent to an REST API server. These are events that Ceilometer needs to collect and store. Most OpenStack components are able to send such events using the notification system built into &lt;em&gt;&lt;a href=&quot;https://wiki.openstack.org/wiki/Oslo/Messaging&quot;&gt;oslo.messaging&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Metrics is what Ceilometer needs to store but that is not necessarily tied to an event. Think about an instance CPU usage, a router network bandwidth usage, the number of images that Glance is storing for you, etc… These are not events, since nothing is happening. These are facts, states we need to meter.&lt;/p&gt;
&lt;p&gt;Computing statistics for billing or capacity planning requires both of these data sources, but they should be distinct. Based on that assumption, and the fact that Ceilometer was getting support for storing events, I started to focus on getting the metric part right.&lt;/p&gt;
&lt;p&gt;I had been a system administrator for a decade before jumping into OpenStack development, so I know a thing or two on how monitoring is done in this area, and what kind of technology operators rely on. I also know that there&apos;s still no silver bullet – this made it a good challenge.&lt;/p&gt;
&lt;p&gt;The first thing that came to my mind was to use some kind of time-series database, and export its access via a REST API – as we do in all OpenStack services. This should cover the metric storage pretty well.&lt;/p&gt;
&lt;h2&gt;Cooking Gnocchi&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi-logo-old-2.jpg&quot; alt=&quot;gnocchi-logo-old-2&quot; /&gt;&lt;/p&gt;
&lt;p&gt;At the end of April 2014, this led met to start a new project code-named Gnocchi. For the record, the name was picked after confusing so many times the OpenStack Marconi project, reading OpenStack Macaroni instead. At least one OpenStack project should have a &quot;pasta&quot; name, right?&lt;/p&gt;
&lt;p&gt;The point of having a new project and not send patches on Ceilometer, was that first I had no clue if it was going to make something that would be any better, and second, being able to iterate more rapidly without being strongly coupled with the release process.&lt;/p&gt;
&lt;p&gt;The first prototype started around the following idea: what you want is to meter things. That means storing a list of tuples of (timestamp, value) for it. I&apos;ve named these things &quot;entities&quot;, as no assumption are made on what they are. An entity can represent the temperature in a room or the CPU usage of an instance. The service shouldn&apos;t care and should be agnostic in this regard.&lt;/p&gt;
&lt;p&gt;One feature that we discussed for several OpenStack summits in the Ceilometer sessions, was the idea of doing aggregation. Meaning, aggregating samples over a period of time to only store a smaller amount of them. These are things that time-series format such as the &lt;a href=&quot;http://oss.oetiker.ch/rrdtool/&quot;&gt;RRDtool&lt;/a&gt; have been doing for a long time on the fly, and I decided it was a good trail to follow.&lt;/p&gt;
&lt;p&gt;I assumed that this was going to be a requirement when storing metrics into Gnocchi. The user would need to provide what kind of archiving it would need: 1 second precision over a day, 1 hour precision over a year, or even both.&lt;/p&gt;
&lt;p&gt;The first driver written to achieve that and store those metrics inside Gnocchi was based on &lt;a href=&quot;http://graphite.wikidot.com/whisper&quot;&gt;whisper&lt;/a&gt;. Whisper is the file format used to store metrics for the &lt;a href=&quot;http://graphite.wikidot.com/&quot;&gt;Graphite&lt;/a&gt; project. For the actual storage, the driver uses Swift, which has the advantages to be part of OpenStack and scalable.&lt;/p&gt;
&lt;p&gt;Storing metrics for each entities in a different &lt;em&gt;whisper&lt;/em&gt; file and putting them in Swift turned out to have a fantastic algorithm complexity: it was &lt;em&gt;O(1)&lt;/em&gt;. Indeed, the complexity needed to store and retrieve metrics doesn&apos;t depends on the number of metrics you have nor on the number of things you are metering. Which is already a huge win compared to the current Ceilometer collector design.&lt;/p&gt;
&lt;p&gt;However, it turned out that &lt;em&gt;whisper&lt;/em&gt; has a few limitations that I was unable to circumvent in any manner. I needed to patch it to remove a lot of its assumption about manipulating file, or that everything is relative to now (&lt;code&gt;time.time()&lt;/code&gt;). I&apos;ve started to hack on that in my own fork, but… then everything broke. The &lt;em&gt;whisper&lt;/em&gt; project code base is, well, not the state of the art, and have 0 unit test. I was starring at a huge effort to transform &lt;em&gt;whisper&lt;/em&gt; into the time-series format I wanted, without being sure I wasn&apos;t going to break everything (remember, no test coverage).&lt;/p&gt;
&lt;p&gt;I decided to take a break and look into alternatives, and stumbled upon &lt;a href=&quot;http://pandas.pydata.org/&quot;&gt;Pandas&lt;/a&gt;, a data manipulation and statistics library for Python. Turns out that Pandas support time-series natively, and that it could do a lot of the smart computation needed in Gnocchi. I built a new file format leveraging Pandas for computing the time-series and named it &lt;strong&gt;carbonara&lt;/strong&gt; (a wink to both the &lt;a href=&quot;https://github.com/graphite-project/carbon&quot;&gt;Carbon&lt;/a&gt; project and pasta, how clever!). The code is quite small (a third of &lt;em&gt;whisper&lt;/em&gt;&apos;s, 200 SLOC vs 600 SLOC), does not have many of the &lt;em&gt;whisper&lt;/em&gt; limitations and… it has test coverage. These Carbonara files are then, in the same fashion, stored into Swift containers.&lt;/p&gt;
&lt;p&gt;Anyway, Gnocchi storage driver system is designed in the same spirit that the rest of OpenStack and Ceilometer storage driver system. It&apos;s a plug-in system with an API, so anyone can write their own driver. Eoghan Glynn has already started to write a &lt;a href=&quot;http://influxdb.com/&quot;&gt;InfluxDB&lt;/a&gt; driver, working closely with the upstream developer of that database. Dina Belova started to write an &lt;a href=&quot;http://opentsdb.net/&quot;&gt;OpenTSDB&lt;/a&gt; driver. This helps to make sure the API is designed directly in the right way.&lt;/p&gt;
&lt;h2&gt;Handling resources&lt;/h2&gt;
&lt;p&gt;Measuring individual entities is great and needed, but you also need to link them with resources. When measuring the temperature and the number of a people in a room, it is useful to link these 2 separate entities to a resource, in that case the room, and give a name to these relations, so one is able to identify what attribute of the resource is actually measured. It is also important to provide the possibility to store attributes on these resources, such as their owners, the time they started and ended their existence, etc.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi-relationship.png&quot; alt=&quot;gnocchi-relationship&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Once this list of resource is collected, the next step is to list and filter them, based on any criteria. One might want to retrieve the list of resources created last week or the list of instances hosted on a particular node right now.&lt;/p&gt;
&lt;p&gt;Resources also need to be specialized. Some resources have attributes that must be stored in order for filtering to be useful. Think about an instance name or a router network.&lt;/p&gt;
&lt;p&gt;All of these requirements led to to the design of what&apos;s called the &lt;em&gt;indexer&lt;/em&gt;. The indexer is responsible for indexing entities, resources, and link them together. The initial implementation is based on &lt;a href=&quot;http://sqlalchemy.org&quot;&gt;SQLAlchemy&lt;/a&gt; and should be pretty efficient. It&apos;s easy enough to index the most requested attributes (columns), and they are also correctly typed.&lt;/p&gt;
&lt;p&gt;We plan to establish a model for all known OpenStack resources (instances, volumes, networks, …) to store and index them into the Gnocchi indexer in order to request them in an efficient way from one place. The generic resource class can be used to handle generic resources that are not tied to OpenStack. It&apos;d be up to the users to store extra attributes.&lt;/p&gt;
&lt;p&gt;Dropping the free form metadata we used to have in Ceilometer makes sure that querying the indexer is going to be efficient and scalable.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi-classes.png&quot; alt=&quot;gnocchi-classes&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;REST API&lt;/h2&gt;
&lt;p&gt;All of this is exported via a REST API that was partially designed and documented in the &lt;a href=&quot;http://git.openstack.org/cgit/openstack/ceilometer-specs/tree/specs/juno/gnocchi.rst&quot;&gt;Gnocchi specification in the Ceilometer repository&lt;/a&gt;; though the spec is not up-to-date yet. We plan to auto-generate the documentation from the code as we are currently doing in Ceilometer.&lt;/p&gt;
&lt;p&gt;The REST API is pretty easy to use, and you can use it to manipulate entities and resources, and request the information back.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/gnocchi-architecture.png&quot; alt=&quot;gnocchi-architecture&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Roadmap &amp;amp; Ceilometer integration&lt;/h2&gt;
&lt;p&gt;All of this plan has been exposed and discussed with the Ceilometer team&lt;br /&gt;
during the last &lt;a href=&quot;https://www.openstack.org/summit/openstack-summit-atlanta-2014/&quot;&gt;OpenStack summit in Atlanta&lt;/a&gt; in May 2014, for the Juno release. I led a session about this entire concept, and convinced the team that using Gnocchi for our metric storage would be a good approach to solve the Ceilometer collector scalability issue.&lt;/p&gt;
&lt;p&gt;It was decided to conduct this project experiment in parallel of the current Ceilometer collector for the time being, and see where that would lead the project to.&lt;/p&gt;
&lt;h2&gt;Early benchmarks&lt;/h2&gt;
&lt;p&gt;Some engineers from Mirantis did a few benchmarks around Ceilometer and also against an early version of Gnocchi, and Dina Belova presented them to us during the mid-cycle sprint we organized in Paris in early July.&lt;/p&gt;
&lt;p&gt;The following graph sums up pretty well the current Ceilometer performance issue. The more you feed it with metrics, the more slow it becomes.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/image03.png&quot; alt=&quot;image03&quot; /&gt;&lt;/p&gt;
&lt;p&gt;For Gnocchi, while the numbers themselves are not fantastic, what is interesting is that all the graphs below show that the performances are stable without correlation with the number of resources, entities or measures. This proves that, indeed, most of the code is built around a complexity of &lt;em&gt;O(1)&lt;/em&gt;, and not &lt;em&gt;O(n)&lt;/em&gt; anymore.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/image00.png&quot; alt=&quot;image00&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;https://julien.danjou.info/content/images/03/image01.png&quot; alt=&quot;image01&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;https://julien.danjou.info/content/images/03/image04.png&quot; alt=&quot;image04&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/image05.png&quot; alt=&quot;image05&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/image06.png&quot; alt=&quot;image06&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Next steps&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/clement-drawing-gnocchi.jpg&quot; alt=&quot;clement-drawing-gnocchi&quot; /&gt;&lt;/p&gt;
&lt;p&gt;While the Juno cycle is being wrapped-up for most projects, including Ceilometer, Gnocchi development is still ongoing. Fortunately, the composite architecture of Ceilometer allows a lot of its features to be replaced by some other code dynamically. That, for example, enables Gnocchi to provides a Ceilometer dispatcher plugin for its collector, without having to ship the actual code in Ceilometer itself. That should help the development of Gnocchi to not be slowed down by the release process for now.&lt;/p&gt;
&lt;p&gt;The Ceilometer team aims to provide Gnocchi as a sort of technology preview with the Juno release, allowing it to be deployed along and plugged with Ceilometer. We&apos;ll discuss how to integrate it in the project in a more permanent and strong manner probably during the &lt;a href=&quot;https://www.openstack.org/summit/openstack-paris-summit-2014/&quot;&gt;OpenStack Summit for Kilo&lt;/a&gt; that will take place next November in Paris.&lt;/p&gt;
</content:encoded><category>openstack</category><category>gnocchi</category></item><item><title>OpenStack Design Summit Juno, from a Ceilometer point of view</title><link>https://julien.danjou.info/blog/openstack-summit-juno-ceilometer/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-summit-juno-ceilometer/</guid><description>Last week was the OpenStack Design Summit in Atlanta, GA where we, developers, discussed and designed the new OpenStack release (Juno) coming up.</description><pubDate>Fri, 30 May 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Last week was the &lt;a href=&quot;https://www.openstack.org/summit/openstack-summit-atlanta-2014/&quot;&gt;OpenStack Design Summit&lt;/a&gt; in Atlanta, GA where we, developers, discussed and designed the new OpenStack release (Juno) coming up. I&apos;ve been there mainly to discuss Ceilometer upcoming developments.&lt;/p&gt;
&lt;p&gt;The summit has been great. It was my third OpenStack design summit, and the first one not being a PTL, meaning it was a largely more relaxed summit for me!&lt;/p&gt;
&lt;p&gt;On Monday, we started by a 2.5 hours meeting with Ceilometer core developers and contributors about the Gnocchi experimental project that I&apos;ve started a few weeks ago. It was a great and productive afternoon, and allowed me to introduce and cover this topic extensively, something that would not have been possible in the allocated session we had later in the week.&lt;/p&gt;
&lt;p&gt;Ceilometer had his design sessions running mainly during Wednesday. We noted a lot of things and commented during the sessions in our &lt;a href=&quot;https://wiki.openstack.org/wiki/Summit/Juno/Etherpads#Ceilometer&quot;&gt;Etherpads instances&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here is a short summary of the sessions I&apos;ve attended.&lt;/p&gt;
&lt;h2&gt;Scaling the central agent&lt;/h2&gt;
&lt;p&gt;I was in charge of the first session, and introduced the work that was done so far in the scaling of the central agent. Six months ago, during the Havana summit, I proposed to scale the central agent by distributing the tasks among several node, using a library to handle the group membership aspect of it. That led to the creation of the &lt;a href=&quot;https://pypi.python.org/pypi/tooz&quot;&gt;tooz&lt;/a&gt; library that we worked on at eNovance during the last 6 months.&lt;/p&gt;
&lt;p&gt;Now that we have this foundation available, Cyril Roelandt started to replace the Ceilometer alarming job repartition code by Taskflow and Tooz. Starting with the central agent is simpler and will be a first proof of concept to be used by the central agent then. We plan to get this merged for Juno.&lt;/p&gt;
&lt;p&gt;For the central agent, the same work needs to be done, but since it&apos;s a bit more complicated, it will be done after the alarming evaluators are converted.&lt;/p&gt;
&lt;h2&gt;Test strategy&lt;/h2&gt;
&lt;p&gt;The next session discussed the test strategy and how we could improve Ceilometer unit and functional testing. There is a lot in this area to be done, and this is going to be one of the main focus of the team in the upcoming weeks. Having Tempest tests run was a goal for Havana, and even if we made a lot of progress, we&apos;re still no there yet.&lt;/p&gt;
&lt;h2&gt;Complex queries and per-user/project data collection&lt;/h2&gt;
&lt;p&gt;This session, led by Ildikó Váncsa, was about adding finer-grained configuration into the pipeline configuration to allow per-user and per-project data retrieval. This was not really controversial, though how to implement this exactly is still to be discussed, but the idea was well received. The other part of the session was about adding more in the complex queries feature provided by the v2 API.&lt;/p&gt;
&lt;h2&gt;Rethinking Ceilometer as a Time-Series-as-a-Service&lt;/h2&gt;
&lt;p&gt;This was my main session, the reason we met on Monday for a few hours, and one of the most promising session – I hope – of the week.&lt;/p&gt;
&lt;p&gt;It appears that the way Ceilometer designed its API and storage backends a long time ago is now a problem to scale the data storage. Also, the events API we introduced in the last release partially overlaps some of the functionality provided by the samples API that causes us scaling troubles.&lt;/p&gt;
&lt;p&gt;Therefore, I&apos;ve started to rethink the Ceilometer API by building it as a time series read/write service, letting the audit part of our previous sample API to the event subsystem. After a few researches and experiments, I&apos;ve designed a new project called &lt;a href=&quot;https://wiki.openstack.org/Gnocchi&quot;&gt;Gnocchi&lt;/a&gt;, which provides exactly that functionality in a hopefully scalable way.&lt;/p&gt;
&lt;p&gt;Gnocchi is split in two parts: a time series API and its driver, and a resource indexing API with its own driver. Having two distinct driver sets allows it to use different technologies to store each data type in the best storage engine possible. The canonical driver for time series handling is based on &lt;a href=&quot;http://pandas.pydata.org/&quot;&gt;Pandas&lt;/a&gt; and &lt;a href=&quot;https://launchpad.net/swift&quot;&gt;Swift&lt;/a&gt;. The canonical resource indexer driver&lt;br /&gt;
is based on &lt;a href=&quot;http://sqlalchemy.org&quot;&gt;SQLAlchemy&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The idea and project was well received and looked pretty exciting to most people. Our hope is to design a version 3 of the Ceilometer API around Gnocchi at some point during the Juno cycle, and have it ready as some sort of preview for the final release.&lt;/p&gt;
&lt;h2&gt;Revisiting the Ceilometer data model&lt;/h2&gt;
&lt;p&gt;This session led by Alexei Kornienko, kind of echoed the previous session, as it clearly also tried to address the Ceilometer scalability issue, but in a different way.&lt;/p&gt;
&lt;p&gt;Anyway, the SQL driver limitations have been discussed and Mehdi Abaakouk implemented some of the suggestions during the week, so we should very soon see more performances in Ceilometer with the current default storage driver.&lt;/p&gt;
&lt;h2&gt;Ceilometer devops session&lt;/h2&gt;
&lt;p&gt;We organized this session to get feedbacks from the devops community about deploying Ceilometer. It was very interesting, and the list of things we could improve is long, and I think will help us to drive our future efforts.&lt;/p&gt;
&lt;h2&gt;SNMP inspectors&lt;/h2&gt;
&lt;p&gt;This session, led by Lianhao Lu, discussed various details of the future of SNMP support in Ceilometer.&lt;/p&gt;
&lt;h2&gt;Alarm and logs improvements&lt;/h2&gt;
&lt;p&gt;This mixed session, led by Nejc Saje and Gordon Chung, was about possible improvements on the alarm evaluation system provided by Ceilometer, and making logging in Ceilometer more effective. Both half-sessions were interesting and led to several ideas on how to improve both systems.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Considering the current QA problems with Ceilometer, Eoghan Glynn, the new &lt;em&gt;Project Technical Leader&lt;/em&gt; for Ceilometer, clearly indicated that this will be the main focus of the release cycle.&lt;/p&gt;
&lt;p&gt;Personally, I will be focused on working on Gnocchi, and will likely be joined by others in the next weeks. Our idea is to develop a complete solution with a high velocity in the next weeks, and then works on its integration with Ceilometer itself.&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>OpenStack Ceilometer Icehouse-2 milestone released</title><link>https://julien.danjou.info/blog/openstack-ceilometer-icehouse-2-milestone-released/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-ceilometer-icehouse-2-milestone-released/</guid><description>Yesterday, the second milestone of the Icehouse development branch of Ceilometer has been released and is now available for testing and download. This means the first half of the OpenStack Icehouse de</description><pubDate>Fri, 24 Jan 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Yesterday, the second milestone of the Icehouse development branch of Ceilometer has been released and is now available for testing and download. This means the first half of the OpenStack &lt;em&gt;Icehouse&lt;/em&gt; development has&lt;br /&gt;
passed!&lt;/p&gt;
&lt;h2&gt;New features&lt;/h2&gt;
&lt;p&gt;For the &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/icehouse-1&quot;&gt;Icehouse-1 milestone&lt;/a&gt;, we barely had enough time to implement 2 blueprints. We almost did a better job this time, but finally only &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/icehouse-2&quot;&gt;2 blueprints were implemented&lt;/a&gt; again. This is really far from what we planned initially. The infrastructure slowdown issues and the lower number of reviews is probably the root cause here.&lt;/p&gt;
&lt;p&gt;Anyway, Ceilometer now offers a &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/specify-event-api&quot;&gt;REST API to accesses the stored event&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The initial work to replace the &lt;code&gt;/v2/meters&lt;/code&gt; endpoint with something more RESTy has started with the &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/sample-api&quot;&gt;implementation of &lt;code&gt;/v2/samples&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Bug fixes&lt;/h2&gt;
&lt;p&gt;Thirty-one bugs were fixed, though most of them might not interest you so I won&apos;t elaborate too much on that. Go read &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/icehouse-2&quot;&gt;the list&lt;/a&gt; if you are curious.&lt;/p&gt;
&lt;h2&gt;Toward Icehouse 3&lt;/h2&gt;
&lt;p&gt;We now have 29 blueprints targeting the &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/icehouse-3&quot;&gt;Ceilometer&apos;s third Icehouse milestone&lt;/a&gt;, with some of them are already started and ready to merge. However, it&apos;s likely that we won&apos;t make all of them. As usual, the priority should indicate how confident we are that we want and need a feature. Still, it&apos;s likely the roadmap will be adjusted in the upcoming weeks. I&apos;ll try to make sure we&apos;ll get there without too much trouble for the 6th March 2013. Stay tuned!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>Databases integration testing strategies with Python</title><link>https://julien.danjou.info/blog/db-integration-testing-strategies-python/</link><guid isPermaLink="true">https://julien.danjou.info/blog/db-integration-testing-strategies-python/</guid><description>The Ceilometer project supports various database backend that can be used as storage. Among them are MongoDB, SQLite MySQL, PostgreSQL, HBase, DB2… All Ceilometer&apos;s code is unit tested, but when.</description><pubDate>Mon, 06 Jan 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt; project supports various database backend that can be used as storage. Among them are &lt;a href=&quot;http://www.mongodb.org/&quot;&gt;MongoDB&lt;/a&gt;, &lt;a href=&quot;http://sqlite.org&quot;&gt;SQLite&lt;/a&gt; &lt;a href=&quot;http://mysql.com&quot;&gt;MySQL&lt;/a&gt;, &lt;a href=&quot;http://postgresql.org&quot;&gt;PostgreSQL&lt;/a&gt;, &lt;a href=&quot;http://hbase.apache.org/&quot;&gt;HBase&lt;/a&gt;, DB2… All Ceilometer&apos;s code is unit tested, but when dealing with external storage services, one cannot be sure that the code is really working. You could be inserting data with an incorrect SQL statement, or in the wrong table. Only having the real database storage running and being used can tell you that.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/python_db_tests.png&quot; alt=&quot;python_db_tests&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Over the months, we developed integration testing on top of our unit testing to validate that our storage drivers are able to deal with real world databases. That is not really different from generic &lt;a href=&quot;http://en.wikipedia.org/wiki/Integration_testing&quot;&gt;integration testing&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Integration testing is about plugging all the pieces of your software all together and running. In what I call &quot;database integration testing&quot;, the pieces will be both your software and the database system that you are going to rely on.&lt;/p&gt;
&lt;p&gt;The only difference here is that one of the module is not coming from the application itself but is an external project. The type of database that you use (RDBMS, NoSQL…) does not matter. Taking a step back, what I will describe here could also apply to a lot of other different software modules, even something that would not be a database sytem at all.&lt;/p&gt;
&lt;h3&gt;Writing tests for integration&lt;/h3&gt;
&lt;p&gt;Presumably, your Python application has unit tests. In order to test against a database back-end, you need to write a few specific classes of tests that will use the database subsystem for real. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import unittest
import os
import sqlalchemy

class TestDB(unittest.TestCase):
    def setUp(self):
       url = os.getenv(&quot;DB_TEST_URL&quot;)
       if not url:
           self.skipTest(&quot;No database URL set&quot;)
       self.engine = sqlalchemy.create_engine(url)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This code will try to fetch the database URL to use from an environment variable, and then will rely on &lt;a href=&quot;http://sqlalchemy.org&quot;&gt;SQLAlchemy&lt;/a&gt; to create a database connection.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import unittest
import os
import sqlalchemy

import myapp

class TestDB(unittest.TestCase):
    def setUp(self):
       url = os.getenv(&quot;DB_TEST_URL&quot;)
       if not url:
           self.skipTest(&quot;No database URL set&quot;)
       self.engine = sqlalchemy.create_engine(url)

    def test_foobar(self):
        self.assertTrue(myapp.store_integer(self.engine, 42))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can then add as many tests as you want using the connection stored in &lt;code&gt;self.engine&lt;/code&gt;. If no test database URL is, the tests will be skipped; however that decision is up to you. You may want to have these tests always run and fail if they can&apos;t be run.&lt;/p&gt;
&lt;p&gt;In the &lt;code&gt;setUp()&lt;/code&gt; method, you may also need to do more work, like create a database and delete a database.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import unittest
import os
import sqlalchemy

class TestDB(unittest.TestCase):
    def setUp(self):
       url = os.getenv(&quot;DB_TEST_URL&quot;)
       if not url:
           self.skipTest(&quot;No database URL set&quot;)
       self.engine = sqlalchemy.create_engine(url)
       self.connection = self.engine.connect()
       self.connection.execute(&quot;CREATE DATABASE testdb&quot;)

    def tearDown(self):
        self.connection.execute(&quot;DROP DATABASE testdb&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will make sure that the database you need is clean and ready to be used to testing.&lt;/p&gt;
&lt;h3&gt;Launching modules, a.k.a. databases&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/postgresql.png&quot; alt=&quot;postgresql&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The main problem we encountered when building integration testing with databases, is to find a way to start them. Most users are used to start them system-wide with some sort of init script, but when running sandboxed tests, that is not really a good option. Browsing the documentation of each storage allowed us to find a way to start them in foreground and control them &quot;interactively&quot; via a shell script.&lt;/p&gt;
&lt;p&gt;The following is a script that you can use to run Python tests using &lt;a href=&quot;http://nose.readthedocs.org/&quot;&gt;nose&lt;/a&gt; and is heavily inspired by the one we wrote for Ceilometer.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
set -e

clean_exit() {
    local error_code=&quot;$?&quot;
    kill -9 $(jobs -p) &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || true
    rm -rf &quot;$PGSQL_DATA&quot;
    return $error_code
}

check_for_cmd () {
    if ! which &quot;$1&quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1
    then
        echo &quot;Could not find $1 command&quot; 1&amp;gt;&amp;amp;2
        exit 1
    fi
}

wait_for_line () {
    while read line
    do
        echo &quot;$line&quot; | grep -q &quot;$1&quot; &amp;amp;&amp;amp; break
    done &amp;lt; &quot;$2&quot;
    # Read the fifo for ever otherwise process would block
    cat &quot;$2&quot; &amp;gt;/dev/null &amp;amp;
}

check_for_cmd postgres

trap &quot;clean_exit&quot; EXIT

## Start PostgreSQL process for tests
PGSQL_DATA=`mktemp -d /tmp/PGSQL-XXXXX`
PGSQL_PATH=`pg_config --bindir`
${PGSQL_PATH}/initdb ${PGSQL_DATA}
mkfifo ${PGSQL_DATA}/out
${PGSQL_PATH}/postgres -F -k ${PGSQL_DATA} -D ${PGSQL_DATA} &amp;amp;&amp;gt; ${PGSQL_DATA}/out &amp;amp;
## Wait for PostgreSQL to start listening to connections
wait_for_line &quot;database system is ready to accept connections&quot; ${PGSQL_DATA}/out
export DB_TEST_URL=&quot;postgresql:///?host=${PGSQL_DATA}&amp;amp;dbname=template1&quot;

## Run the tests
nosetests
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you use &lt;a href=&quot;http://tox.readthedocs.org&quot;&gt;tox&lt;/a&gt; to automatize your test run, you can use this scripts (I call it &lt;code&gt;run-test.sh&lt;/code&gt;) in your &lt;code&gt;tox.ini&lt;/code&gt; file.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[testenv]
commands = {toxinidir}/run-tests.sh {posargs}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/mysql.png&quot; alt=&quot;mysql&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Most databases are able to be run in some sort of standalone mode where you can connect to them using a either a Unix domain socket, or a fixed port. Here are the snippet used in Ceilometer to run with MongoDB and MySQL:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;## Start MongoDB process for tests
MONGO_DATA=$(mktemp -d /tmp/MONGODB-XXXXX)
MONGO_PORT=29000
mkfifo ${MONGO_DATA}/out
mongod --maxConns 32 --nojournal --noprealloc --smallfiles --quiet --noauth --port ${MONGO_PORT} --dbpath &quot;${MONGO_DATA}&quot; --bind_ip localhost &amp;amp;&amp;gt;${MONGO_DATA}/out &amp;amp;
## Wait for Mongo to start listening to connections
wait_for_line &quot;waiting for connections on port ${MONGO_PORT}&quot; ${MONGO_DATA}/out
export DB_TEST_URL=&quot;mongodb://localhost:${MONGO_PORT}/testdb&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/mongodb.png&quot; alt=&quot;mongodb&quot; /&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;## Start MySQL process for tests
MYSQL_DATA=$(mktemp -d /tmp/MYSQL-XXXXX)
mkfifo ${MYSQL_DATA}/out
mysqld --datadir=${MYSQL_DATA} --pid-file=${MYSQL_DATA}/mysql.pid --socket=${MYSQL_DATA}/mysql.socket --skip-networking --skip-grant-tables &amp;amp;&amp;gt; ${MYSQL_DATA}/out &amp;amp;
## Wait for MySQL to start listening to connections
wait_for_line &quot;mysqld: ready for connections.&quot; ${MYSQL_DATA}/out
export DB_TEST_URL=&quot;mysql://root@localhost/testdb?unix_socket=${MYSQL_DATA}/mysql.socket&amp;amp;charset=utf8&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The mechanism is always the same. We create a &lt;em&gt;fifo&lt;/em&gt; with &lt;code&gt;mkfifo&lt;/code&gt;, and then run the database daemon with the output redirected to that fifo. We then read from it until we find a line stating the the database is ready to be used. At that point, we can continue and start running the tests. You have to read continuously from the fifo, otherwise the process writing to it will block. We redirect the output to &lt;code&gt;/dev/null&lt;/code&gt;, but you could also redirect it to a different log file, or not at all.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: &lt;a href=&quot;http://www.die-welt.net/&quot;&gt;Evgeni Golov&lt;/a&gt; pointed it exists a &lt;a href=&quot;https://alioth.debian.org/scm/loggerhead/pkg-postgresql/postgresql-common/trunk/view/head:/pg_virtualenv&quot;&gt;pg_virtualenv&lt;/a&gt; for PostgreSQL and &lt;a href=&quot;https://github.com/evgeni/my_virtualenv&quot;&gt;my_virtualenv&lt;/a&gt; for MySQL that does the same kind of thing, but with more bells and whistles.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;One step further: using parallelism and scenarios&lt;/h3&gt;
&lt;p&gt;The described approach is quite simple, as it only support one database type. When using an abstraction layer, such as SQLAlchemy, it would be a good idea to run all these tests against different RDBMS, such as MySQL and PostgreSQL for example.&lt;/p&gt;
&lt;p&gt;The snippet above allows to run both RDBMS in parallel, but the classic approach of unit tests does not allow that. Using one scenario for each database backend would be a great idea. To that end, you can use the &lt;a href=&quot;https://launchpad.net/testscenarios&quot;&gt;testscenarios&lt;/a&gt; library.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import unittest
import os
import sqlalchemy
import testscenarios

load_tests = testscenarios.load_tests_apply_scenarios

class TestDB(unittest.TestCase):
    scenarios = [
        (&apos;mysql&apos;, dict(database_connection=os.getenv(&quot;MYSQL_TEST_URL&quot;)),
        (&apos;postgresql&apos;, dict(database_connection=os.getenv(&quot;PGSQL_TEST_URL&quot;)),
    ]

    def setUp(self):
       if not self.database_connection:
           self.skipTest(&quot;No database URL set&quot;)
       self.engine = sqlalchemy.create_engine(self.database_connection)
       self.connection = self.engine.connect()
       self.connection.execute(&quot;CREATE DATABASE testdb&quot;)

    def tearDown(self):
        self.connection.execute(&quot;DROP DATABASE testdb&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;$ python -m subunit.run test_scenario | subunit2pyunit
test_scenario.TestDB.test_foobar(mysql)
test_scenario.TestDB.test_foobar(mysql) ... ok
test_scenario.TestDB.test_foobar(postgresql)
test_scenario.TestDB.test_foobar(postgresql) ... ok

---------------------------------------------------------
Ran 2 tests in 0.061s

OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To speed up tests run, you could also run the test in parallel. It can be intesting as you&apos;ll be able to spread the workload among a lot of different CPUs. However, note that it can require a different database for each test or a locking mechanism to be in place. It&apos;s likely that your tests won&apos;t be able to work altogether at the same time on only one database.&lt;/p&gt;
&lt;p&gt;(Both usage of scenarios and parallelism in testing will be covered in &lt;a href=&quot;https://thehackerguidetopython.com&quot;&gt;The Hacker&apos;s Guide to Python&lt;/a&gt;,&lt;br /&gt;
in case you wonder.)&lt;/p&gt;
</content:encoded><category>python</category><category>openstack</category></item><item><title>OpenStack Design Summit Icehouse, from a Ceilometer point of view</title><link>https://julien.danjou.info/blog/openstack-summit-icehouse-ceilometer/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-summit-icehouse-ceilometer/</guid><description>Last week was the OpenStack Design Summit Icehouse in Hong-Kong where we, OpenStack developers, discussed and designed the new OpenStack release (Icehouse) that is coming up.</description><pubDate>Wed, 13 Nov 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Last week was the &lt;a href=&quot;http://www.openstack.org/summit/openstack-summit-hong-kong-2013/&quot;&gt;OpenStack Design Summit Icehouse&lt;/a&gt; in Hong-Kong where we, OpenStack developers, discussed and designed the new OpenStack release (Icehouse) that is coming up.&lt;/p&gt;
&lt;p&gt;The week has been wonderful. It was my second OpenStack design summit, and I loved it. Bumping into various people I&apos;ve never met so far and worked with online was a real pleasure. As it was to meet again with fellow OpenStack developers! The event organisation was great, as were the parties. :-)&lt;/p&gt;
&lt;p&gt;On the last day, I had the chance to present a talk with Eoghan Glynn and Nick Barcet how we built the auto-scaling feature in Heat, implementing the &quot;alarming&quot; feature needed in Ceilometer.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/ods_icehouse_ceilometer_heat_nijaba_eglynn_jd.jpg&quot; alt=&quot;ods_icehouse_ceilometer_heat_nijaba_eglynn_jd&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Design sessions&lt;/h2&gt;
&lt;p&gt;This time, Ceilometer design sessions were spread on 3 days. Everything we talked about has its &lt;a href=&quot;https://wiki.openstack.org/wiki/Summit/Icehouse/Etherpads#Ceilometer&quot;&gt;Etherpad instance&lt;/a&gt;. The discussions were interesting, and the amount of feedback gathered is big and is going to be very useful.&lt;/p&gt;
&lt;p&gt;There&apos;s a lot of people and companies using Ceilometer now, and the project is getting more and more traction in general. There&apos;s a lot of different way to use it and to bend it to one&apos;s needs. Considering the amount of features and options that is provided, building functionality with a genericized approach it making Ceilometer useful for a lot of different and interesting use-cases.&lt;/p&gt;
&lt;h2&gt;Icehouse roadmap&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/icehouse&quot;&gt;list of blueprints targeting Icehouse is available&lt;/a&gt;, but not yet complete. I expect people to start filling this list in the next days. If you want to propose blueprints, you&apos;re free to do so and inform us about it so we can validate it. The same applies if you wish to implement one of them!&lt;/p&gt;
&lt;p&gt;Thereafter, I try to guess what the roadmap will look like in the upcoming weeks for Ceilometer based on the discussion we had last week during the summit.&lt;/p&gt;
&lt;h3&gt;Events management&lt;/h3&gt;
&lt;p&gt;A lot of work is going to be put into event management. Ceilometer plans to store notifications sent using &lt;em&gt;oslo.messaging&lt;/em&gt; by OpenStack projects. Some work already got merge for Havana, but the API part and future improvements and ideas will continue to flow into the Icehouse release.&lt;/p&gt;
&lt;h3&gt;Agents and group management&lt;/h3&gt;
&lt;p&gt;A lot has been discussed around the polling agents and around the alarm evaluator agent.&lt;/p&gt;
&lt;p&gt;The current state of the &lt;em&gt;ceilometer-central-agent&lt;/em&gt; disallows any kind of high-availability and load-balancing, as the polling task are kept and scheduled on only one node.&lt;/p&gt;
&lt;p&gt;The high-availability part is already covered by a custom mechanism built into &lt;em&gt;ceilometer-alarm-evaluator&lt;/em&gt;, but it came clear to us that a more generic approach is needed. A lot of other projects needs this kind of functionality, and a pattern have been pointed out. A &lt;a href=&quot;https://wiki.openstack.org/wiki/Oslo/blueprints/service-sync&quot;&gt;blueprint about group membership&lt;/a&gt; has been discussed in an Oslo session, and will end into a new Python library written to solve this in Ceilometer and in other projects.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://wiki.openstack.org/wiki/Taskflow&quot;&gt;TaskFlow&lt;/a&gt; will also probably be leveraged to solve the task distribution issue.&lt;/p&gt;
&lt;h3&gt;Documentation&lt;/h3&gt;
&lt;p&gt;Since a few weeks, Ceilometer auto-generates its &lt;a href=&quot;http://api.openstack.org/api-ref-metering.html&quot;&gt;API reference documentation&lt;/a&gt; using &lt;a href=&quot;https://git.openstack.org/cgit/stackforge/sphinxcontrib-docbookrestapi/&quot;&gt;sphinxcontrib-docbookrestapi&lt;/a&gt; that parses our API code that uses &lt;a href=&quot;https://pypi.python.org/pypi/WSME&quot;&gt;WSME&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We also want to start writing a user guide, and we&apos;ll do that inside our own repository. That way, I hope that we will be the first project in OpenStack to require documentation to be incorporated into every patch that&apos;s being sent to Ceilometer. This is the best way to assure that nothing can be changed nor added without being accompanied with a documentation update.&lt;/p&gt;
&lt;h3&gt;Tempest testing&lt;/h3&gt;
&lt;p&gt;Testing of Ceilometer already has been a subject during the previous design summit about testing. We already put a large effort on Tempest testing in this last cycle, but we encountered a lot of small issues that we had to tackle to achieve something. Some Ceilometer basic tests are already on their way into Tempest, so this is something that is going to be achieved very soon.&lt;/p&gt;
&lt;p&gt;Ultimately, I would also want Ceilometer moving towards providing its own set of Tempest tests as part of the code base. That way, it&apos;d be as easy for core reviewers to refuse a patch if it doesn&apos;t provide functional tests as it is to refuse it if it doesn&apos;t provide unit tests. As we&apos;ll do for the documentation.&lt;/p&gt;
&lt;h3&gt;API improvements&lt;/h3&gt;
&lt;p&gt;Once again, a few API improvements will probably be implemented, like aggregation or the ability to specify multiple queries with &lt;em&gt;OR&lt;/em&gt; and &lt;em&gt;AND&lt;/em&gt; operators.&lt;/p&gt;
&lt;h3&gt;Roll-up, archiving of data&lt;/h3&gt;
&lt;p&gt;There seems to be interest in archiving and rolling-up the data stored by Ceilometer, so work in this area is to be expected. Supporting multiple data storage driver in parallel seems to be something that needs to be done for this and other aspects of Ceilometer feature set.&lt;/p&gt;
&lt;h3&gt;Alarming&lt;/h3&gt;
&lt;p&gt;The alarming feature set is already big, and the work that has been accomplished pretty amazing. A few improvements will be made, as retrieving better metrics and building better statistics (exclusion of low quality data points).&lt;/p&gt;
</content:encoded><category>openstack</category><category>talks</category></item><item><title>OpenStack Ceilometer Havana-3 milestone released</title><link>https://julien.danjou.info/blog/openstack-ceilometer-havana-3-milestone-released/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-ceilometer-havana-3-milestone-released/</guid><description>Last week, the third and last milestone of the Havana development branch of Ceilometer has been released and is now available for testing and download. This means the end of the OpenStack Havana devel</description><pubDate>Tue, 10 Sep 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Last week, the third and last milestone of the Havana development branch of Ceilometer has been released and is now available for testing and download. This means the end of the OpenStack &lt;em&gt;Havana&lt;/em&gt; development time is coming, and that the features are now frozen.&lt;/p&gt;
&lt;h2&gt;New features&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/blueprint-1.jpg&quot; alt=&quot;blueprint-1&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Eleven blueprints have been implemented as you can see on the &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/havana-3&quot;&gt;release page&lt;/a&gt;. That&apos;s one more than during Havana-2, but it&apos;s less than was planned initially, though we had a pretty high score considering the size of our contributors team. I&apos;m going to talk through some of them here, that are the most interesting for users.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Our favorite &lt;a href=&quot;https://wiki.openstack.org/wiki/OutreachProgramForWomen&quot;&gt;OPW&lt;/a&gt; intern Terri Yu implemented the long awaited &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/api-group-by&quot;&gt;GROUP BY API feature&lt;/a&gt;, that allows to group samples by fields before returning statistics.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Eoghan Glynn (Red Hat) continued his implementation of alarming features, and the &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/alarm-audit-api&quot;&gt;audit API&lt;/a&gt; has been merged. A few blueprints related to alarming slipped and will be delayed for RC1, as they have been granted feature freeze exceptions:&lt;br /&gt;
&lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/alarming-logical-combination&quot;&gt;logical combinations of alarms&lt;/a&gt; and &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/alarm-service-partitioner&quot;&gt;alarm service partitioner&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;With the help of Gordon Chung (IBM), I&apos;ve worked on creating a &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/count-api-requests&quot;&gt;middleware to meter API requests&lt;/a&gt;. This has been merged into Oslo and is handled by Ceilometer. Gordon added another middleware on top of it to add CADF support for audit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ceilometer agent compute gained his second inspector to poll for virtual machine, thanks to Alessandro Pilotti (Cloudbase) who implemented &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/hyper-v-agent&quot;&gt;the Hyper-V inspector&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ceilometer will be able to meter Neutron bandwidth thanks to eNovance folks that worked on &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/ceilometer-quantum-bw-metering&quot;&gt;bandwidth metering blueprint&lt;/a&gt;, both on Ceilometer and Neutron parts. This is also a long awaited feature.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Finally, Ceilometer will be shipped with yet another storage back-end, as Tong Li (IBM) implemented a &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/ibm-db2-support&quot;&gt;DB2 driver&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Bug fixes&lt;/h2&gt;
&lt;p&gt;Fifty-six bugs were fixed, though most of them might not interest you so I won&apos;t elaborate too much on that. Go read &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/havana-3&quot;&gt;the list&lt;/a&gt; if you are curious.&lt;/p&gt;
&lt;h2&gt;Toward our final Havana release&lt;/h2&gt;
&lt;p&gt;With the feature freeze in place, we&apos;re now focusing on fixing bugs and improving documentation. I&apos;ll try to make sure we&apos;ll get there without too much trouble for the 17th October 2013. Stay tuned!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>OpenStack Ceilometer Havana-2 milestone released</title><link>https://julien.danjou.info/blog/openstack-ceilometer-havana-2-milestone-released/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-ceilometer-havana-2-milestone-released/</guid><description>Last week, the second milestone of the Havana development branch of Ceilometer has been released and is now available for testing and download. This means the first half of the OpenStack Havana develo</description><pubDate>Sat, 27 Jul 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Last week, the second milestone of the Havana development branch of Ceilometer has been released and is now available for testing and download. This means the first half of the OpenStack &lt;em&gt;Havana&lt;/em&gt; development has passed!&lt;/p&gt;
&lt;h2&gt;New features&lt;/h2&gt;
&lt;p&gt;Ten blueprints have been implemented as you can see on the &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/havana-2&quot;&gt;release page&lt;/a&gt;. I&apos;m going to talk through some of them here, that are the most interesting for users.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/blueprint.jpg&quot; alt=&quot;blueprint&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The Ceilometer API now returns &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/api-sample-sorted&quot;&gt;all the samples sorted by timestamp&lt;/a&gt;. This blueprint is the first one implemented by Terri Yu, our &lt;a href=&quot;https://wiki.openstack.org/wiki/OutreachProgramForWomen&quot;&gt;OPW&lt;/a&gt; intern! In the same spirit, I&apos;ve added the ability to &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/api-limit&quot;&gt;limit the number of samples returned&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On the alarming front, things evolved a lot. I&apos;ve implemented the &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/alarm-notifier&quot;&gt;notifier system&lt;/a&gt; that will be used to run actions when alarms are triggered. To trigger these alarms, Eoghan Glynn (Red Hat) worked on the &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/alarm-distributed-threshold-evaluation&quot;&gt;alarm evaluation system&lt;/a&gt; that will use the Ceilometer API to check for alarm states.&lt;/p&gt;
&lt;p&gt;I&apos;ve reworked the publisher system so it now uses &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/pipeline-publisher-url&quot;&gt;URL formatted target&lt;/a&gt; for publication. That now allows to publish different meters to different target using the same publishing protocol (e.g. via UDP toward different hosts).&lt;/p&gt;
&lt;p&gt;Sandy Walsh (RackSpace) have been working on the StackTach like functionality and added the ability for the collector to optionally &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/collector-stores-events&quot;&gt;store the notification events received&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Finally, Mehdi Abaakouk (eNovance) implemented a &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/db-ttl&quot;&gt;TTL system for the database&lt;/a&gt;, so you&apos;re now able to expire your data whenever you like.&lt;/p&gt;
&lt;h2&gt;Bug fixes&lt;/h2&gt;
&lt;p&gt;Thirty-five bugs were fixed, though most of them might not interest you so I won&apos;t elaborate too much on that. Go read &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/havana-2&quot;&gt;the list&lt;/a&gt; if you are curious.&lt;/p&gt;
&lt;h2&gt;Toward Havana 3&lt;/h2&gt;
&lt;p&gt;We now have 30 blueprints targeting the &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/havana-3&quot;&gt;Ceilometer&apos;s third Havana milestone&lt;/a&gt;, with some of them are already started. I&apos;ll try to make sure we&apos;ll get there without too much trouble for the 6th September 2013. Stay tuned!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>OpenStack meets Lisp: cl-openstack-client</title><link>https://julien.danjou.info/blog/lisp-and-openstack-with-cl-openstack-client/</link><guid isPermaLink="true">https://julien.danjou.info/blog/lisp-and-openstack-with-cl-openstack-client/</guid><description>Building an OpenStack client library in Common Lisp, exploring what it takes to bring the OpenStack community beyond Python.</description><pubDate>Thu, 04 Jul 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A month ago, a mail hit the &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; mailing list entitled &quot;&lt;a href=&quot;https://lists.launchpad.net/openstack/msg24349.html&quot;&gt;The OpenStack Community Welcomes Developers in All Programming Languages&lt;/a&gt;&quot;. You may know that OpenStack is essentially built using Python, and therefore it is the reference language for the client libraries implementations. As a Lisp and OpenStack practitioner, I used this excuse to build a challenge for myself: let&apos;s prove this point by bringing Lisp into OpenStack!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/cl-openstack-client-1.png&quot; alt=&quot;cl-openstack-client-1&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Welcome &lt;a href=&quot;https://github.com/stackforge/cl-openstack-client&quot;&gt;cl-openstack-client&lt;/a&gt;, the OpenStack client library for &lt;a href=&quot;http://common-lisp.net/&quot;&gt;Common Lisp&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;The project is hosted on the classic OpenStack infrastructure for third party project, &lt;a href=&quot;http://ci.openstack.org/stackforge.html&quot;&gt;StackForge&lt;/a&gt;. It provides the &lt;a href=&quot;https://jenkins.openstack.org/job/gate-cl-openstack-client-run-tests/&quot;&gt;continuous integration system based on Jenkins&lt;/a&gt; and the Gerrit infrastructure used to review contributions.&lt;/p&gt;
&lt;h2&gt;How the tests works&lt;/h2&gt;
&lt;p&gt;OpenStack projects ran a fabulous contribution workflow, &lt;a href=&quot;https://julien.danjou.info/blog/2013/rant-about-github-pull-request-workflow-implementation&quot;&gt;which I already talked about&lt;/a&gt;, based on tools like &lt;a href=&quot;http://gerrit.googlecode.com/&quot;&gt;Gerrit&lt;/a&gt; and &lt;a href=&quot;http://jenkins-ci.org/&quot;&gt;Jenkins&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;OpenStack Python projects are used to run &lt;a href=&quot;https://pypi.python.org/pypi/tox&quot;&gt;tox&lt;/a&gt;, to build a virtual environment and run test inside. We don&apos;t have such thing in Common Lisp as far as I know, so I had to build it myself.&lt;/p&gt;
&lt;p&gt;Fortunately, using &lt;a href=&quot;http://www.quicklisp.org/&quot;&gt;Quicklisp&lt;/a&gt;, the fabulous equivalent of Python&apos;s PyPI, it has been a breeze to set this up. &lt;em&gt;cl-openstack-client&lt;/em&gt; just includes a &lt;a href=&quot;https://github.com/stackforge/cl-openstack-client/blob/master/run-tests.sh&quot;&gt;basic shell script&lt;/a&gt; that does the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download quicklisp.lisp&lt;/li&gt;
&lt;li&gt;Run a &lt;a href=&quot;https://github.com/stackforge/cl-openstack-client/blob/master/update-deps.lisp&quot;&gt;Lisp program to install the dependencies using Quicklisp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Run a &lt;a href=&quot;https://github.com/stackforge/cl-openstack-client/blob/master/run-tests.lisp&quot;&gt;Lisp program running the test suite&lt;/a&gt; using &lt;a href=&quot;http://common-lisp.net/project/fiveam/&quot;&gt;FiveAM&lt;/a&gt;, that exit with 0 or 1 based on the tests results.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I just run the test using &lt;a href=&quot;http://www.sbcl.org&quot;&gt;SBCL&lt;/a&gt;, though adding more compiler on the table would be a really good plan in the future, and should be straightforward. You can &lt;a href=&quot;https://jenkins.openstack.org/job/gate-cl-openstack-client-run-tests/4/console&quot;&gt;admire a log from a successful test&lt;/a&gt; run done when I proposed a patch via Gerrit, to check what it looks like.&lt;/p&gt;
&lt;h2&gt;Implementation status&lt;/h2&gt;
&lt;p&gt;For the curious, here&apos;s an example of how it works:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;* (require &apos;cl-openstack-client)
* (use-package &apos;cl-keystone-client)
* (defvar k (make-instance &apos;connection-v2 :username &quot;demo&quot; :password &quot;somepassword&quot; :tenant-name &quot;demo&quot; :url &quot;http://devstack:5000&quot;))

K

* (authenticate k)

((:ISSUED--AT . &quot;2013-07-04T05:59:55.454226&quot;)
 (:EXPIRES . &quot;2013-07-05T05:59:55Z&quot;)
 (:ID
  . &quot;wNFQwNzo1OTo1NS40NTQyMthisisaverylongtokenwNFQwNzo1OTo1NS40NTQyM&quot;)
 (:TENANT (:DESCRIPTION) (:ENABLED . T)
  (:ID . &quot;1774fd545df4400380eb2b4f4985b3be&quot;) (:NAME . &quot;demo&quot;)))

* (connection-token-id k)

&quot;wNFQwNzo1OTo1NS40NTQyMthisisaverylongtokenwNFQwNzo1OTo1NS40NTQyM&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Unfortunately, the implementation is far from being complete. It only implements for now the Keystone token retrieval.&lt;/p&gt;
&lt;p&gt;I&apos;ve actually started this project to build an already working starting point. With this, future potential contributors will be able to spend efforts on writing code, and not on setting up the basic continuous integration system or module infrastructure.&lt;/p&gt;
&lt;p&gt;If you wish to help me and contribute, just follow the &lt;a href=&quot;https://wiki.openstack.org/wiki/GerritWorkflow&quot;&gt;OpenStack Gerrit workflow howto&lt;/a&gt; or feel free to come by me and ask any question (I&apos;m hanging out on #lisp on Freenode too).&lt;/p&gt;
&lt;p&gt;See you soon, hopping to bring more Lisp into OpenStack!&lt;/p&gt;
</content:encoded><category>lisp</category><category>openstack</category></item><item><title>OpenStack Ceilometer Havana-1 milestone released</title><link>https://julien.danjou.info/blog/openstack-ceilometer-havana-1-milestone-released/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-ceilometer-havana-1-milestone-released/</guid><description>Yesterday, the first milestone of the Havana development branch of Ceilometer has been released and is now available for testing and download. This means the first quarter of the OpenStack Havana deve</description><pubDate>Fri, 31 May 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Yesterday, the first milestone of the Havana development branch of Ceilometer has been released and is now available for testing and download. This means the first quarter of the OpenStack &lt;em&gt;Havana&lt;/em&gt; development has passed!&lt;/p&gt;
&lt;h2&gt;New features&lt;/h2&gt;
&lt;p&gt;Ten blueprints have been implemented as you can see on the &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/havana-1&quot;&gt;release page&lt;/a&gt;. I&apos;m going to talk through some of them here, that are the most interesting for users.&lt;/p&gt;
&lt;p&gt;Ceilometer can now &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/scheduler-counter&quot;&gt;counts the scheduling attempt&lt;/a&gt; of instances done by &lt;em&gt;nova-scheduler&lt;/em&gt;. This can be useful to eventually bill such information or for audit (implemented by me for eNovance).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/hbase.png&quot; alt=&quot;hbase&quot; /&gt;&lt;/p&gt;
&lt;p&gt;People using the &lt;a href=&quot;http://hbase.apache.org/&quot;&gt;HBase&lt;/a&gt; backend can now do requests filtering on any of the counter fields, something we call &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/hbase-metadata-query&quot;&gt;metadata queries&lt;/a&gt;, and which was missing for this backend driver. Thanks to Shengjie Min (Dell) for the implementation.&lt;/p&gt;
&lt;p&gt;Counters can now be &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/udp-publishing&quot;&gt;sent over UDP&lt;/a&gt; instead of the Oslo RPC mechanism (AMQP based by default). This allows counter transmission to be done in a much faster way, though less reliable. The primary use case being not audit or billing, but the alarming features that we are working on (implemented by me for eNovance).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/siren.png&quot; alt=&quot;siren&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/alarm-api&quot;&gt;initial alarm API&lt;/a&gt; has been designed and implemented, thanks to Mehdi Abaakouk (eNovance) and Angus Salkled (RedHat) who tackled this. We&apos;re now able to do &lt;em&gt;CRUD&lt;/em&gt; actions on these.&lt;/p&gt;
&lt;p&gt;Posting of meters via the HTTP API is now possible. This is now another conduct that can be used to publish and collector meter. Thanks to Angus Salkled (RedHat) for implementing this.&lt;/p&gt;
&lt;p&gt;I&apos;ve been working on an somewhat experimental &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/oslo-multi-publisher&quot;&gt;notifier driver for Oslo&lt;/a&gt; notification that publishes Ceilometer counters instead of the standard notification, using the Ceilometer pipeline setup.&lt;/p&gt;
&lt;p&gt;Sandy Walsh (Rackspace) has put in place the base needed to &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/add-event-table&quot;&gt;store raw notifications (events)&lt;/a&gt;, with the final goal of bringing more functionalities around these into Ceilometer.&lt;/p&gt;
&lt;p&gt;Obviously, all of this blueprint and bug fixes wouldn&apos;t be implemented or fixed without the harden eyes of our entire team, reviewing code and advising restlessly the developers. Thanks to them!&lt;/p&gt;
&lt;h2&gt;Bug fixes&lt;/h2&gt;
&lt;p&gt;Thirty-one bugs were fixed, though most of them might not interest you so I won&apos;t elaborate too much on that. Go read &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/havana-1&quot;&gt;the list&lt;/a&gt; if you are curious.&lt;/p&gt;
&lt;h2&gt;Toward Havana 2&lt;/h2&gt;
&lt;p&gt;We now have 21 blueprints targeting the &lt;a href=&quot;https://launchpad.net/ceilometer/+milestone/havana-2&quot;&gt;Ceilometer&apos;s second Havana milestone&lt;/a&gt;, with some of them are already started. I&apos;ll try to make sure we&apos;ll get there without too much trouble for the 18th July 2013. Stay tuned!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>Rant about Github pull-request workflow implementation</title><link>https://julien.danjou.info/blog/rant-about-github-pull-request-workflow-implementation/</link><guid isPermaLink="true">https://julien.danjou.info/blog/rant-about-github-pull-request-workflow-implementation/</guid><description>One of my recent innocent tweet about Gerrit vs Github triggered much more reponses and debate that I expected it to. I realize that it might be worth explaining a bit what I meant, in a text longer t</description><pubDate>Fri, 10 May 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;One of my recent innocent tweet about &lt;em&gt;Gerrit vs Github&lt;/em&gt; triggered much more reponses and debate that I expected it to. I realize that it might be worth explaining a bit what I meant, in a text longer than 140 characters.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I&apos;m having a hard time now contributing to projects not using Gerrit. Github isn&apos;t that good.&lt;/p&gt;
&lt;p&gt;— Julien Danjou (@juldanjou) &lt;a href=&quot;https://twitter.com/juldanjou/status/332076595521146881&quot;&gt;May 8, 2013&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;The problems with Github pull-requests&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/github-1.svg&quot; alt=&quot;github-1&quot; /&gt;&lt;/p&gt;
&lt;p&gt;I always looked at Github from a distant eye, mainly because I always disliked their pull-request handling, and saw no value in the social hype it brings. Why?&lt;/p&gt;
&lt;h3&gt;One click away isn&apos;t one click effort&lt;/h3&gt;
&lt;p&gt;The pull-request system looks like an incredible easy way to contribute to any project hosted on Github. You&apos;re a click away to send your contribution to any software. But the problem is that any worthy contribution isn&apos;t an effort of a single click.&lt;/p&gt;
&lt;p&gt;Doing any proper and useful contribution to a software is never done right the first time. There&apos;s a dance you will have to play. A slowly rhythmed back and forth between you and the software maintainer or team. You&apos;ll have to dance it until your contribution is correct and can be merged.&lt;/p&gt;
&lt;p&gt;But as a software maintainer, not everybody is going to follow you on this choregraphy, and you&apos;ll end up with pull-request you&apos;ll never get finished unless you wrap things up yourself. So the gain in pull-requests here, isn&apos;t really bigger than a good bug report in most cases.&lt;/p&gt;
&lt;p&gt;This is where the social argument of Github isn&apos;t anymore. As soon as you&apos;re talking about projects bigger than a color theme for your favorite text editor, this feature is overrated.&lt;/p&gt;
&lt;h3&gt;Contribution rework&lt;/h3&gt;
&lt;p&gt;If you&apos;re lucky enough, your contributor will play along and follow you on this pull-request review process. You&apos;ll make suggestions, he will listen and will modify his pull-request to follow your advice.&lt;/p&gt;
&lt;p&gt;At this point, there&apos;s two technics he can use to please you.&lt;/p&gt;
&lt;h4&gt;Technic #1: the Topping&lt;/h4&gt;
&lt;p&gt;Github&apos;s pull-requests invite you to send an entire branch, eclipsing the fact that it is composed of several commits. The problem is that a lot of one-click-away contributors do not masterize Git and/or do not make efforts to build a logical patchset, and nothing warns them that their branch history is wrong. So they tend to change stuff around, commit, make a mistake, commit, fix this mistake, commit, etc. This kind of branch is composed of the whole brain&apos;s construction process of your contributor, and is a real pain to review. To the point I quite often give up.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/github-pull-request-iterative.png&quot; alt=&quot;github-pull-request-iterative&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Without Github, the old method that all software used, and that many software still use (e.g. Linux), is to send a patch set over e-mail (or any other medium like Gerrit). This method has one positive effect, that it forces the contributor to acknowledge the list of commits he is going to publish. So, if the contributor he has fixup commits in his history, they are going to be seen as first class citizen. And nobody is going to want to see that, neither your contributor, nor the software maintainers. Therefore, such a system tend to push contributors to write atomic, logical and self-contained patchset that can be more easily reviewed.&lt;/p&gt;
&lt;h4&gt;Technic #2: the History Rewriter&lt;/h4&gt;
&lt;p&gt;This is actually the good way to build a working and logical patchset using Git. Rewriting history and amending problematic patches using the famous &lt;code&gt;git rebase --interactive&lt;/code&gt; trick.&lt;/p&gt;
&lt;p&gt;The problem is that if your contributor does this and then repush the branch composing your pull-request to Github, you will both lose the previous review done, each time. There&apos;s no history on the different versions of the branch that has been pushed.&lt;/p&gt;
&lt;p&gt;In the old alternative system like e-mail, no information is lost when reworked patches are resent, obviously. This is far better because it eases the following of the iterative discussions that the patch triggered.&lt;/p&gt;
&lt;p&gt;Of course, it would be possible for Github to enhance this and fix it, but currently it doesn&apos;t handle this use case correctly..&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/hylang-pull-request-157.png&quot; alt=&quot;Exercise for the doubtful readers: good luck finding all revisions of my patch in the pull-request #157 of Hy.&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;A quick look at OpenStack workflow&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/openstack-5.png&quot; alt=&quot;openstack-5&quot; /&gt;&lt;/p&gt;
&lt;p&gt;It&apos;s not a secret for anyone that I&apos;ve been contributing to OpenStack as a daily routine for the last 18 months. The more I contribute, the more I like the contribution workflow and process. It&apos;s already &lt;a href=&quot;https://wiki.openstack.org/wiki/Gerrit_Workflow&quot;&gt;well and longly described on the wiki&lt;/a&gt;, so I&apos;ll summarize here my view and what I like about it.&lt;/p&gt;
&lt;h3&gt;Gerrit&lt;/h3&gt;
&lt;p&gt;To send a contribution to any OpenStack project, you need to pass via Gerrit. This is way simpler than doing a pull-request on Github actually, all you have to do is do your commit(s), and type &lt;a href=&quot;https://pypi.python.org/pypi/git-review&quot;&gt;&lt;code&gt;git review&lt;/code&gt;&lt;/a&gt;. That&apos;s it. Your patch will be pushed to Gerrit and available for review.&lt;/p&gt;
&lt;p&gt;Gerrit allows other developers to review your patch, add comments anywhere on it, and score your patch up or down. You can build any rule you want for the score needed for a patch to be merged; OpenStack requires one positive scoring from two core developers before the patch is merged.&lt;/p&gt;
&lt;p&gt;Until a patch is validated, it can be reworked and amended locally using Git, and then resent using &lt;code&gt;git review&lt;/code&gt; again. That simple. The historic and the different version of the patches are available, with the whole comments. Gerrit doesn&apos;t lose any historic information on your workflow.&lt;/p&gt;
&lt;p&gt;Finally, you&apos;ll notice that this is actually the same kind of workflow projects use when they work by patch sent over e-mail. Gerrit just build a single place to regroup and keep track of patchsets, which is really handy. It&apos;s also much easier for people to actually send patch using a command line tool than their MUA or &lt;em&gt;git send-email&lt;/em&gt;.&lt;/p&gt;
&lt;h3&gt;Gate testing&lt;/h3&gt;
&lt;p&gt;Testing is mandatory for any patch sent to OpenStack. Unit tests and functionnals test are run for &lt;em&gt;each version of each patch of the patchset&lt;/em&gt; sent. And until your patch passes all tests, it will be &lt;em&gt;impossible&lt;/em&gt; to merge it.&lt;/p&gt;
&lt;p&gt;Yes, this implies that all patches in a patchset must be working commits and can be merged on their own, without the entire patchset going in! With such a restricution, it&apos;s impossible to have &quot;fixup commits&quot; merged in your project and pollute the history and the testability of the project.&lt;/p&gt;
&lt;p&gt;Once your patch is validated by core developers, the system checks that there is not any merge conflicts. If there&apos;s not, tests are re-run, since the branch you are pushing to might have changed, and if everything&apos;s fine, the patch is merged.&lt;/p&gt;
&lt;p&gt;This is an uncredible force for the quality of the project. This implies that no broken patchset can ever sneak in, and that the project pass always all tests.&lt;/p&gt;
&lt;h2&gt;Conclusion: accessibility vs code review&lt;/h2&gt;
&lt;p&gt;In the end, I think that one of the key of any development process, which is code review, is not well covered by Github pull-request system. It is, along with history integrity, damaged by the goal of making contributions easier.&lt;/p&gt;
&lt;p&gt;Choosing between these features is probably a trade-off that each project should do carefully, considering what are its core goals and the quality of code it want to reach.&lt;/p&gt;
&lt;p&gt;I tend to find that OpenStack found one of the best trade-off available using Gerrit and plugging testing automation via Jenkins on it, and I would probably recommend it for any project taking seriously code reviews and testing.&lt;/p&gt;
</content:encoded><category>github</category><category>openstack</category></item><item><title>OpenStack Design Summit Havana, from a Ceilometer point of view</title><link>https://julien.danjou.info/blog/openstack-summit-havana-ceilometer/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-summit-havana-ceilometer/</guid><description>Last week was the OpenStack Design Summit in Portland, OR where we, developers, discussed and designed the new OpenStack release (Havana) coming up.</description><pubDate>Thu, 25 Apr 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Last week was the &lt;a href=&quot;https://www.openstack.org/summit/portland-2013/&quot;&gt;OpenStack Design Summit&lt;/a&gt; in Portland, OR where we, developers, discussed and designed the new OpenStack release (Havana) coming up.&lt;/p&gt;
&lt;p&gt;The summit has been wonderful. It was my first OpenStack design summit -- even more as a PTL -- and bumping into various people I&apos;ve never met so far and worked with online only was a real pleasure!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/ods_havana_ceilometer_nijaba_jd_talk.jpg&quot; alt=&quot;ods_havana_ceilometer_nijaba_jd_talk&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://nicolas.barcet.com/&quot;&gt;Nick Barcet&lt;/a&gt; from &lt;a href=&quot;http://www.enovance.com&quot;&gt;eNovance&lt;/a&gt;, our dear previous Ceilometer PTL, and myself, talked about Ceilometer and presented the work that has been done for Grizzly, with some previews of what we&apos;ll like to see done for its Havana release.&lt;/p&gt;
&lt;h2&gt;Design sessions&lt;/h2&gt;
&lt;p&gt;Ceilometer had his design sessions during the last days of the summit. We noted a lot of things and commented during the sessions in our &lt;a href=&quot;https://wiki.openstack.org/wiki/Summit/Havana/Etherpads#Ceilometer&quot;&gt;Etherpads instances&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The first session was a description of Ceilometer core architecture for interested people, and was a wonderful success considering that the room was packed. Our &lt;a href=&quot;http://doughellmann.com/&quot;&gt;Doug Hellmann&lt;/a&gt; did a wonderful job introducing people to Ceilometer and answering question.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/ods_havana_ceilometer_dhellmann.jpg&quot; alt=&quot;ods_havana_ceilometer_dhellmann&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The next session was about getting feedbacks from our users. We had a lot of surprise to discover wonderful real use-cases and deployments, like the CERN using Ceilometer and generating 2 GB of data per day!&lt;/p&gt;
&lt;p&gt;The following sessions ran on Thursday and were much more about new features discussion. A lot ot already existing blueprints were discussed and quickly validated during the first morning session. Then, &lt;a href=&quot;http://www.sandywalsh.com/&quot;&gt;Sandy Walsh&lt;/a&gt; introduced the architecture they use inside &lt;a href=&quot;https://github.com/rackerlabs/stacktach&quot;&gt;StackTach&lt;/a&gt;, so we can start thinking about getting things from it into Ceilometer.&lt;/p&gt;
&lt;p&gt;API improvements were discussed without surprises and with a good consensus on what needs to be done. The four following sessions that occupied a lot of the days were related to alarming. All were lead by Eoghan Glynn, from &lt;a href=&quot;http://redhat.com&quot;&gt;Red Hat&lt;/a&gt;, who did an amazing job presenting the possible architectures with theirs pros and cons. Actually, all we had to do was to nod to his designs and acknowledge the plan on how to build this.&lt;/p&gt;
&lt;p&gt;That last two sessions were about discussing advanced models for billing where we got some interesting feedback from Daniel Dyer from HP, and then were a quick follow-up of the StackTach presentation from the morning session.&lt;/p&gt;
&lt;h2&gt;Havana roadmap&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/havana&quot;&gt;list of blueprints targeting Havana is available&lt;/a&gt; and should be finished by next week. If you want to propose blueprints, you&apos;re free to do so and inform us about it so we can validate it. The same applies if you wish to implement one of them!&lt;/p&gt;
&lt;h3&gt;API extension&lt;/h3&gt;
&lt;p&gt;I do think the API version 2 is going to be heavily extended during this release cycle. We need more feature, like the &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/api-group-by&quot;&gt;group-by&lt;/a&gt;&lt;br /&gt;
functionality.&lt;/p&gt;
&lt;h3&gt;Healthnmon&lt;/h3&gt;
&lt;p&gt;In parallel of the design sessions, discussions took place in the unconference room with the Healthnmon developers to figure out a plan in order to merge some of their efforts into Ceilometer. They should provide a component to help Ceilometer supports more hypervisors than it currently does.&lt;/p&gt;
&lt;h3&gt;Alarming&lt;/h3&gt;
&lt;p&gt;Alarming is definitely going to be the next big project for Ceilometer. Today, Eoghan and I started building blueprints on alarming, &lt;a href=&quot;https://blueprints.launchpad.net/ceilometer/+spec/alarming&quot;&gt;centralised in a general blueprint&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We know this is going to happen for real and very soon, thanks to the engagements of &lt;a href=&quot;http://enovance.com&quot;&gt;eNovance&lt;/a&gt; and &lt;a href=&quot;http://redhat.com&quot;&gt;Red Hat&lt;/a&gt; who are committing resources to this amazing project!&lt;/p&gt;
</content:encoded><category>openstack</category><category>talks</category></item><item><title>Announcing Climate, the OpenStack capacity leasing project</title><link>https://julien.danjou.info/blog/openstack-climate-capacity-leasing/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-climate-capacity-leasing/</guid><description>While working on the XLcloud project (HPC on cloud) it appeared clear to us that OpenStack was missing a critical component towards resource reservations.</description><pubDate>Mon, 25 Mar 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;While working on the &lt;a href=&quot;http://xlcloud.org/bin/view/Main/&quot;&gt;XLcloud project&lt;/a&gt; (HPC on cloud) it appeared clear to us that OpenStack was missing a critical component towards resource reservations.&lt;/p&gt;
&lt;p&gt;A capacity leasing service is something really needed by service providers, especially in the context of cloud platforms dedicated to HPC style workload. Instead of building something really specific, the decision has been made to build a new standalone OpenStack components aiming to provide this kind of functionnality to OpenStack. In the spirit of others OpenStack components, it will be extensible to fullfil a large panel of needs around this problematic.&lt;/p&gt;
&lt;p&gt;The project is named &lt;a href=&quot;http://launchpad.net/climate&quot;&gt;Climate&lt;/a&gt;, and is hosted on &lt;a href=&quot;http://ci.openstack.org/stackforge.html&quot;&gt;StackForge&lt;/a&gt;. It will follow the standard OpenStack development modal. This service will be able to handle a calendar of reservations for various resources, based on various criteria.&lt;/p&gt;
&lt;p&gt;The project is still at its early design stage, and we plan to have a unconference session during &lt;a href=&quot;http://www.openstack.org/summit/portland-2013/&quot;&gt;the next OpenStack summit in Portland&lt;/a&gt; to present our plans and ideas for the future!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>Ceilometer bug squash day #2</title><link>https://julien.danjou.info/blog/ceilometer-bug-squash-day-2/</link><guid isPermaLink="true">https://julien.danjou.info/blog/ceilometer-bug-squash-day-2/</guid><description>The Ceilometer team is pleased to announce that tomorrow Tuesday 5th March 2013 will be the second bug squash day for Ceilometer.</description><pubDate>Mon, 04 Mar 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The Ceilometer team is pleased &lt;a href=&quot;http://lists.openstack.org/pipermail/openstack-dev/2013-March/006188.html&quot;&gt;to announce&lt;/a&gt; that tomorrow &lt;a href=&quot;http://wiki.openstack.org/Ceilometer/BugSquashingDay/20130304&quot;&gt;Tuesday 5th March 2013 will be the second bug squash day for Ceilometer&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We wrote an extensive page about &lt;a href=&quot;http://wiki.openstack.org/Ceilometer/Contributing&quot;&gt;how you can contribute to Ceilometer&lt;/a&gt;, from updating the documentation, to fixing bugs. There&apos;s a lot you can do. We&apos;ve good support for Ceilometer built into &lt;a href=&quot;http://devstack.org&quot;&gt;Devstack&lt;/a&gt;, so installing a development platform is really easy.&lt;/p&gt;
&lt;p&gt;The main goal for this bug day will be to put Ceilometer in the best possible shape before the &lt;em&gt;grizzly-rc1&lt;/em&gt; release arrives (14th March 2013). This version of Ceilometer &lt;em&gt;should&lt;/em&gt; be the last one before the final Grizzly release, so it&apos;s a pretty important one.&lt;/p&gt;
&lt;p&gt;We&apos;ll be hanging out on the &lt;em&gt;#openstack-metering&lt;/em&gt; IRC channel on &lt;a href=&quot;http://freenode.net&quot;&gt;Freenode&lt;/a&gt;, as usual, so feel free to come by and join us!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>OpenStack Ceilometer and Heat projects graduated</title><link>https://julien.danjou.info/blog/openstack-ceilometer-heat-graduated/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-ceilometer-heat-graduated/</guid><description>The OpenStack Technical Committee has voted these last weeks about graduation of Heat and Ceilometer, to change their status from incubation to integrated.</description><pubDate>Wed, 27 Feb 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/openstack-tech-committee.jpg&quot; alt=&quot;openstack-tech-committee&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://www.openstack.org/foundation/technical-committee/&quot;&gt;OpenStack Technical Committee&lt;/a&gt; has voted these last weeks about graduation of &lt;a href=&quot;https://launchpad.net/heat&quot;&gt;Heat&lt;/a&gt; and &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt;, to change their status from &lt;strong&gt;incubation&lt;/strong&gt; to &lt;strong&gt;integrated&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The details of the discussion can be found in the &lt;a href=&quot;http://eavesdrop.openstack.org/meetings/tc/2013/&quot;&gt;TC IRC meetings logs&lt;/a&gt; for the brave. The results are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Approve graduation of Heat (to be integrated in common Havana release)? yes: 10, abstain: 1, no: 1&lt;/li&gt;
&lt;li&gt;Approve graduation of Ceilometer (to be integrated in common Havana release)? yes: 11, abstain: 1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Therefore both projects have been graduated from &lt;em&gt;Incubation&lt;/em&gt; to &lt;em&gt;Integrated&lt;/em&gt; status. That means that Heat and Ceilometer will be released as part as OpenStack for the next release cycle &lt;em&gt;Havana&lt;/em&gt;, due in Autumn 2013.&lt;/p&gt;
&lt;p&gt;For people being curious, we the Ceilometer team put up a &lt;a href=&quot;https://wiki.openstack.org/wiki/Ceilometer/Graduation&quot;&gt;nice wiki page about our status and what we think we were ready to jump&lt;/a&gt;. For the curious, The &lt;a href=&quot;https://wiki.openstack.org/wiki/Governance/Foundation/TechnicalCommittee&quot;&gt;OpenStack Technical Committee charter&lt;/a&gt; has some explanations about the incubation and integration process.&lt;/p&gt;
&lt;h2&gt;What about Grizzly?&lt;/h2&gt;
&lt;p&gt;Both projects will be released with Grizzly too, obviously, since they already follow the release process of OpenStack.&lt;/p&gt;
&lt;h2&gt;What about core?&lt;/h2&gt;
&lt;p&gt;The question that has been raised several times to me is if that means the projects are becoming &lt;em&gt;Core&lt;/em&gt; projects. The answer is no, because how to become a &lt;em&gt;Core&lt;/em&gt; project is still under discussion and is more a matter for the &lt;em&gt;Board of Directors&lt;/em&gt; than the &lt;em&gt;Technical Committee&lt;/em&gt;. But this is definitely a step in this direction.&lt;/p&gt;
&lt;p&gt;Anyway, from a technical point of view, this means both projects are now onboard with other OpenStack components so you can enjoy them!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>Cloud tools for Debian</title><link>https://julien.danjou.info/blog/cloud-init-utils-debian/</link><guid isPermaLink="true">https://julien.danjou.info/blog/cloud-init-utils-debian/</guid><description>Recently, I&apos;ve worked on the cloud utilities that are provided as standard in Ubuntu, and I ported them to Debian. Let&apos;s see how that brings Debian to the cloud!  Basics of a cloud image When starting</description><pubDate>Wed, 13 Feb 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Recently, I&apos;ve worked on the cloud utilities that are provided as standard in Ubuntu, and I ported them to Debian. Let&apos;s see how that brings Debian to the cloud!&lt;/p&gt;
&lt;h2&gt;Basics of a cloud image&lt;/h2&gt;
&lt;p&gt;When starting an instance on a IaaS platform, your instance image is raw, un-configured. Therefore, you need to have a way to configure it automagically at boot time, based on what you want to do with it. Usually, IaaS platforms provides for this a metadata server, like &lt;a href=&quot;http://aws.amazon.com/ec2&quot;&gt;Amazon EC2&lt;/a&gt; does. It&apos;s a special HTTP server listening on a special and hard-coded IP address that your instance can request to know basic information about itself, like its hostname, and retrieve basic user metadata to auto-configure itself. You can check the &lt;a href=&quot;http://docs.openstack.org/trunk/openstack-compute/admin/content/metadata-service.html&quot;&gt;documentation about the OpenStack metadata service&lt;/a&gt; for more information.&lt;/p&gt;
&lt;p&gt;Also, image have a predefined size at upload time. So when you run it on a platform, the disk size you request is usually bigger than the size of your image disk: you mayneed to resize and grow your image to use the full disk space that is allocated to your instance.&lt;/p&gt;
&lt;h2&gt;Needed tools&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/debian-cloud-1.jpg&quot; alt=&quot;debian-cloud-1&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To run a cloud platform, and especially &lt;a href=&quot;http://aws.amazon.com/ec2&quot;&gt;Amazon EC2&lt;/a&gt; or &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt;, you need to configure and update your image based on the context you&apos;re started in. This also includes extending your template image disk to use the full available disk size provided to the running instance.&lt;/p&gt;
&lt;p&gt;Ubuntu provides a set of cloud utils, which is actually composed of different source packages (&lt;em&gt;cloud-init&lt;/em&gt;, &lt;em&gt;cloud-utils&lt;/em&gt; and &lt;em&gt;clout-initiramfs-tools&lt;/em&gt;).&lt;/p&gt;
&lt;p&gt;Combined, these 3 packages will allow you to run a number of step, from disk resize at boot time to Puppet configuration handling.&lt;/p&gt;
&lt;p&gt;So &lt;em&gt;Ubuntu&lt;/em&gt; got this working right a long time ago, but unfortunately, Debian was really late on that.&lt;/p&gt;
&lt;p&gt;Until now.&lt;/p&gt;
&lt;p&gt;I&apos;ve worked on getting these into Debian, and you can now find these 3 packages adapted and uploaded to Debian sid.&lt;/p&gt;
&lt;p&gt;All you need to do, is to build a Debian image and then run:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt-get install cloud-init cloud-tools cloud-initiramfs-growroot
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And voilà: at the next reboot, your instance will extend its root partition size to the full available disk size, and ask the metadata server to configure things like its hostname.&lt;/p&gt;
&lt;p&gt;The packages sources are available on Debian&apos;s git server for &lt;a href=&quot;http://anonscm.debian.org/gitweb/?p=collab-maint/cloud-utils.git;a=summary&quot;&gt;cloud-utils&lt;/a&gt;&lt;br /&gt;
and &lt;a href=&quot;http://anonscm.debian.org/gitweb/?p=collab-maint/cloud-initramfs-tools.git;a=summary&quot;&gt;cloud-initramfs-tools&lt;/a&gt; and you can build them yourself until the packages are processed by ftp-master and get out of the &lt;a href=&quot;http://ftp-master.debian.org/new.html&quot;&gt;NEW queue&lt;/a&gt;. cloud-init on the other hand is directly &lt;a href=&quot;http://packages.debian.org/search?keywords=cloud-init&quot;&gt;available in sid&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;One of next steps would probably be to build or enhance a tool like &lt;a href=&quot;https://launchpad.net/vmbuilder&quot;&gt;vmbuilder&lt;/a&gt; to be able to build cloud-compatible Debian images with a simple command line.&lt;/p&gt;
</content:encoded><category>debian</category><category>openstack</category></item><item><title>Extending Swift with middleware: example with ClamAV</title><link>https://julien.danjou.info/blog/extending-swift-with-a-middleware-clamav/</link><guid isPermaLink="true">https://julien.danjou.info/blog/extending-swift-with-a-middleware-clamav/</guid><description>In this article, I&apos;m going to explain you how you can extend Swift, the OpenStack Object Storage project, so it performs extra action on files at upload or at download time.</description><pubDate>Tue, 22 Jan 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;In this article, I&apos;m going to explain you how you can extend &lt;a href=&quot;http://launchpad.net/swift&quot;&gt;Swift&lt;/a&gt;, the &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; Object Storage project, so it performs extra action on files at upload or at download time.&lt;/p&gt;
&lt;p&gt;We&apos;re going to build an anti-virus filter inside Swift. The goal is to refuse uploaded data if they contain a virus. To help us with virus analyses, we&apos;ll use &lt;a href=&quot;http://www.clamav.net&quot;&gt;ClamAV&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;WSGI, paste and middleware&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/lolcat-tube.jpg&quot; alt=&quot;lolcat-tube&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To do our content analysis, the best place to hook in the Swift architecture is at the beginning of every request, on &lt;strong&gt;swift-proxy&lt;/strong&gt;, before the file is actually stored on the cluster. Swift proxy uses, like many other OpenStack projects, &lt;a href=&quot;https://pypi.python.org/pypi/Paste&quot;&gt;paste&lt;/a&gt; to build his HTTP architecture.&lt;/p&gt;
&lt;p&gt;Paste uses WSGI and provides an architecture based on a pipeline. The pipeline is composed of a succession of middleware, ending with one application. Each middleware has the chance to look at the request or at the response, can modify it, and then pass it to the following middleware. The latest component of the pipeline is the real application, and in this case, the Swift proxy server.&lt;/p&gt;
&lt;p&gt;If you&apos;ve already deployed Swift, you encountered a default pipeline in the &lt;em&gt;swift-proxy.conf&lt;/em&gt; configuration file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[pipeline:main]
pipeline = catch_errors healthcheck cache ratelimit tempauth proxy-logging proxy-server
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a really basic pipeline with a few middleware. The first one catches error, the second one is in charge to return &lt;em&gt;200 OK&lt;/em&gt; response if you send a &lt;code&gt;GET /healthcheck&lt;/code&gt; request on your proxy server. The third one is in charge of caching, the fourth one is used for rate limiting, the fifth for authentication, the sixth one for logging, and the final one is the actual proxy server, in charge of proxying the request to the account, container, or object servers (the others components of Swift). Of course, we could remove or add any of the middleware here at our convenience.&lt;/p&gt;
&lt;p&gt;Be aware that the order matters: for example, if you put &lt;em&gt;healthcheck&lt;/em&gt; after &lt;em&gt;tempauth&lt;/em&gt;, you won&apos;t be able to access the &lt;em&gt;/healthcheck&lt;/em&gt; URL without being authenticated!&lt;/p&gt;
&lt;h2&gt;ClamAV&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/clamav.png&quot; alt=&quot;clamav&quot; /&gt;&lt;/p&gt;
&lt;p&gt;If you don&apos;t know &lt;a href=&quot;http://clamav.org&quot;&gt;ClamAV&lt;/a&gt;, it&apos;s an antivirus engine designed for detecting trojans, viruses, malware and other malicious threats. Wwe&apos;re going to use it to scan every incoming file. To build the middleware, we&apos;ll use the Python binding &lt;a href=&quot;http://pypi.python.org/pypi/clamd&quot;&gt;pyclamd&lt;/a&gt;. The API is quite simple, see:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import pyclamd
&amp;gt;&amp;gt;&amp;gt; pyclamd.init_unix_socket(&apos;/var/run/clamav/clamd.ctl&apos;)
&amp;gt;&amp;gt;&amp;gt; print pyclamd.scan_stream(pyclamd.EICAR)
{&apos;stream&apos;: &apos;Eicar-Test-Signature(44d88612fea8a8f36de82e1278abb02f:68)&apos;}
&amp;gt;&amp;gt;&amp;gt; print pyclamd.scan_stream(&quot;safe!&quot;)
None
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Anatomy of a WSGI middleware&lt;/h2&gt;
&lt;p&gt;Your WSGI middleware should consist of a callable object. Usually this is done with a class implementing the &lt;em&gt;__call__&lt;/em&gt; method. Here&apos;s a basic boilerplate:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class SwiftClamavMiddleware(object):
    &quot;&quot;&quot;Middleware doing virus scan for Swift.&quot;&quot;&quot;

    def __init__(self, app, conf):
        # app is the final application
        self.app = app

    def __call__(self, env, start_response):
        return self.app(env, start_response)

def filter_factory(global_conf, **local_conf):
    conf = global_conf.copy()
    conf.update(local_conf)

    def clamav_filter(app):
        return SwiftClamavMiddleware(app, conf)
    return clamav_filter
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I&apos;m not going to expand more on why this is built this way, but if you want to have more info on this kind of filter middleware, you can read &lt;a href=&quot;http://pythonpaste.org/deploy/#paste-filter-factory&quot;&gt;their documentation on Paste&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This middleware will just do nothing as it is. It&apos;s going to simply pass all requests it receives to the final application, and returns the result.&lt;/p&gt;
&lt;h2&gt;Testing our basic middleware&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/lolcat-testing.jpg&quot; alt=&quot;lolcat-testing&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Now is a really good time to add unit tests. I hope you didn&apos;t think we were going to write code without some tests, right? It&apos;s really easy to test a middleware, as we&apos;re going to use &lt;a href=&quot;http://webob.org/&quot;&gt;WebOb&lt;/a&gt; for that.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import unittest
from webob import Request

class FakeApp(object):
    def __call__(self, env, start_response):
        return Response(body=&quot;FAKE APP&quot;)(env, start_response)

class TestSwiftClamavMiddleware(unittest.TestCase):

    def setUp(self):
        self.app = SwiftClamavMiddleware(FakeApp(), {})

    def test_simple_request(self):
        resp = Request.blank(&apos;/&apos;,
                             environ={
                                 &apos;REQUEST_METHOD&apos;: &apos;GET&apos;,
                             }).get_response(self.app)
        self.assertEqual(resp.body, &quot;FAKE APP&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We create a FakeApp class, that represents a fake WSGI application. You could also use a real application, or write a fake application looking like the one you want to test. It&apos;ll require more time, but your tests will be closer to the reality.&lt;/p&gt;
&lt;p&gt;Here we write the simplest test we can for our middleware. We&apos;re just sending a &lt;em&gt;GET /&lt;/em&gt; request to it, so it passes the request to the final application and returns the result. It is transparent, it does nothing.&lt;/p&gt;
&lt;p&gt;Now, with that solid base we&apos;ll able to add more features and test these features incrementally.&lt;/p&gt;
&lt;h2&gt;Plugging ClamAV in&lt;/h2&gt;
&lt;p&gt;With our base ready, we can start thinking about how to plug ClamAV in. What we want to check here, is the content of the file when it&apos;s uploaded. If we refer to the &lt;a href=&quot;http://docs.openstack.org/api/openstack-object-storage/1.0/content/&quot;&gt;OpenStack object storage API&lt;/a&gt;, a file upload is done via a &lt;em&gt;PUT&lt;/em&gt; request, so we&apos;re going to limit the check to that kind of requests. Obviously, more checks could be added, but we&apos;ll keep things simple here for the sake of comprehensibility.&lt;/p&gt;
&lt;p&gt;With WSGI, the content of the request is available in &lt;code&gt;env[&apos;wsgi.input&apos;]&lt;/code&gt; as an object implementing a file interface. We&apos;ll scan that stream with ClamAV to check for viruses.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import pyclamd
from webob import Response

class SwiftClamavMiddleware(object):
    &quot;&quot;&quot;Middleware doing virus scan for Swift.&quot;&quot;&quot;

    def __init__(self, app, conf):
        pyclamd.init_unix_socket(&apos;/var/run/clamav/clamd.ctl&apos;)
        # app is the final application
        self.app = app

    def __call__(self, env, start_response):
        if env[&apos;REQUEST_METHOD&apos;] == &quot;PUT&quot;:
            # We have to read the whole content in memory because pyclamd
            # forces us to, but this is a bad idea if the file is huge.
            scan = pyclamd.scan_stream(env[&apos;wsgi.input&apos;].read())
            if scan:
                return Response(status=403,
                                body=&quot;Virus %s detected&quot; % scan[&apos;stream&apos;],
                                content_type=&quot;text/plain&quot;)(env, start_response)
        return self.app(env, start_response)

def filter_factory(global_conf, **local_conf):
    conf = global_conf.copy()
    conf.update(local_conf)

    def clamav_filter(app):
        return SwiftClamavMiddleware(app, conf)
    return clamav_filter
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That&apos;s it. We only check for &lt;em&gt;PUT&lt;/em&gt; requests and if there&apos;s a virus in the file, we return a 403 Forbidden error with the name of the detected virus, bypassing entirely the rest of the middleware chain and the application handling.&lt;/p&gt;
&lt;p&gt;Then, we can simply test it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import unittest
from cStringIO import StringIO
from webob import Request, Response

class FakeApp(object):
    def __call__(self, env, start_response):
        return Response(body=&quot;FAKE APP&quot;)(env, start_response)

class TestSwiftClamavMiddleware(unittest.TestCase):
    def setUp(self):
        self.app = SwiftClamavMiddleware(FakeApp(), {})

    def test_put_empty(self):
        resp = Request.blank(&apos;/v1/account/container/object&apos;,
                             environ={
                                 &apos;REQUEST_METHOD&apos;: &apos;PUT&apos;,
                             }).get_response(self.app)
        self.assertEqual(resp.body, &quot;FAKE APP&quot;)

    def test_put_no_virus(self):
        resp = Request.blank(&apos;/v1/account/container/object&apos;,
                             environ={
                                 &apos;REQUEST_METHOD&apos;: &apos;PUT&apos;,
                                 &apos;wsgi.input&apos;: StringIO(&apos;foobar&apos;)
                             }).get_response(self.app)
        self.assertEqual(resp.body, &quot;FAKE APP&quot;)

    def test_put_virus(self):
        resp = Request.blank(&apos;/v1/account/container/object&apos;,
                             environ={
                                 &apos;REQUEST_METHOD&apos;: &apos;PUT&apos;,
                                 &apos;wsgi.input&apos;: StringIO(pyclamd.EICAR)
                             }).get_response(self.app)
        self.assertEqual(resp.status_code, 403)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first test &lt;em&gt;test_put_empty&lt;/em&gt; simulates an empty &lt;em&gt;PUT&lt;/em&gt; request. The second one, &lt;em&gt;test_put_no_virus&lt;/em&gt; simulates a regular &lt;em&gt;PUT&lt;/em&gt; request but with a simple file containing no virus.&lt;/p&gt;
&lt;p&gt;Finally, the third and last test simulates the upload of a virus using the &lt;a href=&quot;http://www.eicar.org/&quot;&gt;EICAR&lt;/a&gt; test file. This is a special test file that is recognized as a virus, even if it&apos;s not real one. Very handy for testing virus detection software!&lt;/p&gt;
&lt;h2&gt;Configuring Swift proxy&lt;/h2&gt;
&lt;p&gt;Our middleware is ready! We can configure Swift&apos;s proxy server to use it. We need to add the following lines to our &lt;em&gt;swift-proxy.conf&lt;/em&gt; to teach it how to load the filter:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[filter:clamav]
paste.filter_factory = swiftclamav:filter_factory
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We&apos;ll assume that our Python modules is named &lt;em&gt;swiftclamava&lt;/em&gt; here. Now that we&apos;ve defined our filter and how to load it, we can use it in our pipeline:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[pipeline:main]
pipeline = catch_errors healthcheck cache ratelimit tempauth clamav proxy-logging proxy-server
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Just before reaching the &lt;em&gt;proxy-server&lt;/em&gt;, and after the user being authenticated, the content will be scanned for viruses. It&apos;s important here to put this after authentication for example, because otherwise we may scan content that will get rejected by the authtemp module, thus scanning for nothing!&lt;/p&gt;
&lt;h2&gt;Beyond scanning&lt;/h2&gt;
&lt;p&gt;And voilà, we now have a simple middleware testing uploaded content and refusing infected files. We could enhance it with various other things, like configuration handling, but I&apos;ll let that as an exercise for the interested readers.&lt;/p&gt;
&lt;p&gt;We didn&apos;t exploited it here, but note that you can also manipulate request headers and modify them if needed. For example, we could have added a header &lt;em&gt;X-Object-Meta-Scanned-By: ClamAV&lt;/em&gt; to indicates that the file has been scanned by ClamAV.&lt;/p&gt;
&lt;p&gt;You should now be able to build your own middleware doing whatever you want with uploaded data. Happy hacking!&lt;/p&gt;
</content:encoded><category>openstack</category><category>security</category></item><item><title>Ceilometer bug squash day #1</title><link>https://julien.danjou.info/blog/ceilometer-bug-squash-day-1/</link><guid isPermaLink="true">https://julien.danjou.info/blog/ceilometer-bug-squash-day-1/</guid><description>In order to start the year in a good mood, what&apos;s the best than squashing some bugs on OpenStack?</description><pubDate>Mon, 24 Dec 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;In order to start the year in a good mood, what&apos;s the best than squashing some bugs on OpenStack?&lt;/p&gt;
&lt;p&gt;Therefore, the Ceilometer team is pleased &lt;a href=&quot;http://lists.openstack.org/pipermail/openstack-dev/2012-December/004161.html&quot;&gt;to announce&lt;/a&gt; that it organizes a &lt;a href=&quot;http://wiki.openstack.org/Ceilometer/BugSquashingDay/20130104&quot;&gt;bug squashing day on the Friday 4th January 2013&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We wrote an extensive page about &lt;a href=&quot;http://wiki.openstack.org/Ceilometer/Contributing&quot;&gt;how you can contribute to Ceilometer&lt;/a&gt;, from updating the documentation, to fixing bugs. There&apos;s a lot you can do. We&apos;ve good support for Ceilometer built into &lt;a href=&quot;http://devstack.org&quot;&gt;Devstack&lt;/a&gt;, so installing a development platform is really easy.&lt;/p&gt;
&lt;p&gt;The main goal on this bug day will be put Ceilometer in the best possible shape before the &lt;em&gt;grizzly-2&lt;/em&gt; milestone arrives (10th January 2013). This version of Ceilometer will aim to keep compatibility with &lt;em&gt;Folsom&lt;/em&gt;, so early deployers can enjoy some of our new features before upgrading to &lt;em&gt;Grizzly&lt;/em&gt;. After that date, we&apos;ll start merging more extensive changes.&lt;/p&gt;
&lt;p&gt;We&apos;ll be hanging out on the &lt;em&gt;#openstack-metering&lt;/em&gt; IRC channel on &lt;a href=&quot;http://freenode.net&quot;&gt;Freenode&lt;/a&gt;, as usual, so feel free to come by and join us!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>OpenStack France meetup #2</title><link>https://julien.danjou.info/blog/openstack-france-meetup-2/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-france-meetup-2/</guid><description>I was at the OpenStack France meetup 2 yesterday evening.</description><pubDate>Tue, 06 Nov 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I was at the &lt;a href=&quot;http://www.meetup.com/OpenStack-France/events/84177022/&quot;&gt;OpenStack France meetup 2&lt;/a&gt; yesterday evening.&lt;/p&gt;
&lt;p&gt;This has been a wonderful evening, talking about OpenStack and all with around 30-40 people. I and &lt;a href=&quot;http://nicolas.barcet.com/&quot;&gt;Nick Barcet&lt;/a&gt; presented &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt; and have received some good feedbacks about it.&lt;/p&gt;
&lt;p&gt;We should also thanks &lt;a href=&quot;http://www.nebula.com/&quot;&gt;Nebula&lt;/a&gt;, who sponsored the evening, and &lt;a href=&quot;http://erwan.com/&quot;&gt;Erwan Gallen&lt;/a&gt; since it was nicely organized, and free beers are always enjoyable.&lt;/p&gt;
</content:encoded><category>openstack</category><category>talks</category></item><item><title>Inside Synaps, a CloudWatch-like implementation for OpenStack</title><link>https://julien.danjou.info/blog/openstack-synaps-exploration/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-synaps-exploration/</guid><description>A few days ago, Samsung released the source code of Synaps, an implementation of the Amazon Web Service CloudWatch API for OpenStack.</description><pubDate>Mon, 22 Oct 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A few days ago, &lt;a href=&quot;http://www.samsung.com/&quot;&gt;Samsung&lt;/a&gt; released the source code of &lt;a href=&quot;https://github.com/spcs/synaps&quot;&gt;Synaps&lt;/a&gt;, an implementation of the &lt;a href=&quot;http://aws.amazon.com/cloudwatch/&quot;&gt;Amazon Web Service CloudWatch API&lt;/a&gt; for &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Being a developer on the &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt; project, I&apos;ve been curious to look on this project and how it could overlap with Ceilometer or other projects like &lt;a href=&quot;http://www.heat-api.org&quot;&gt;Heat&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;What is CloudWatch?&lt;/h2&gt;
&lt;p&gt;CloudWatch is a monitoring system provided by Amazon on its Web Services platform to monitor services. This allows you get notifications and trigger an action on certain threshold.&lt;/p&gt;
&lt;p&gt;For example, this can be used to scale your architecture by monitoring the number of requests you get on it and its general load by starting new servers.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/cloudwatch.jpg&quot; alt=&quot;cloudwatch&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Synaps&lt;/h2&gt;
&lt;p&gt;Synaps is written in around 7k lines of Python (with 28 % of which are comments), reuses at least one common module of OpenStack (&lt;em&gt;openstack.common.cfg&lt;/em&gt;) and copy some modules from Nova. One thing that strikes me, is that there seems to be only a few unit tests compared to most OpenStack projects. Also, many parts of the code and documentation contains text written in korean, which won&apos;t be very helpful for most people! :-) It uses some external technologies, like &lt;a href=&quot;http://storm-project.net/&quot;&gt;Storm&lt;/a&gt;, &lt;a href=&quot;http://cassandra.apache.org/&quot;&gt;Cassandra&lt;/a&gt; to store its persistent data and &lt;a href=&quot;http://pandas.pydata.org/&quot;&gt;Pandas&lt;/a&gt; to do data analysis.&lt;/p&gt;
&lt;p&gt;The API server provides an EC2 compatible API only: no OpenStack specific API. This is probably not a bad thing for now, since I am not aware of any work in this direction. The API access directly the Cassandra back-end for read operation, but relies on RPC to do writes. This way, a set of daemon handles the write using the Storm part of Synaps and do data aggregation. The authentication only supports LDAP, but it should still be possible to add a driver for Keystone.&lt;/p&gt;
&lt;p&gt;A Java and a Python SDK are provided to record metrics into Synaps, but&lt;br /&gt;
there&apos;s not enough documentation for it to be useful.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/SynapsDeployment-1.jpg&quot; alt=&quot;SynapsDeployment-1&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Overlap with Heat&lt;/h2&gt;
&lt;p&gt;For now, there&apos;s not a lot of overlap with Heat, because Heat does not implement completely the CloudWatch API. Heat actually still misses a lot of the CloudWatch functions. But as soon as it will implement the CloudWatch API completely, the overlap will be complete with Synaps in this regard.&lt;/p&gt;
&lt;p&gt;One divergence point however, is that Heat uses RPC to access data from the storage back-end via its engine (the central daemon), whereas Synaps directly connects to Cassandra. Also, Heat relies on SQLAlchemy, like most OpenStack projects needing a database.&lt;/p&gt;
&lt;h2&gt;Overlap with Ceilometer&lt;/h2&gt;
&lt;p&gt;One of the goal of Ceilometer is to provide data probes and pollsters for all OpenStack components (Nova, Swift, Quantum…) whereas Synaps let the OpenStack users to put any kind of metric inside it, and therefore doesn&apos;t provide anything for now.&lt;/p&gt;
&lt;p&gt;But the storage of metrics is the main common point between Synaps and Ceilometer. Synaps chose only one technology, Cassandra, to store its metrics, whereas Ceilometer took care of building an abstraction layer for the storage engine. Ceilometer currently allows an operator to use SQL or MongoDB, but Cassandra could likely be added.&lt;/p&gt;
&lt;p&gt;Data metric consolidation is done by Synaps. This makes sense, since Synaps don&apos;t need to have the full data history to trigger alarms. On the opposite, Ceilometer needs to have a full history to allow things like billing, and don&apos;t do any aggregation on data.&lt;/p&gt;
&lt;p&gt;Also, in Synaps, the data analysis is done using Pandas. This means the data used are retrieved from the Cassandra back-end, and then transformed by Pandas inside Synaps in something else. It&apos;s likely that in such a case, Synaps should use CQL to achieve that. Ceilometer manipulates the data near their storage: it means that the computation are done by back-end to be efficient (SQL, mapreduce…).&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Considering Samsung open-sourced Synaps late in the development process, I don&apos;t feel like they aimed to have it becoming a core component. This is always sad, because the effort put into this implementation are big and it would have probably little to add some abstraction layers to follow what other OpenStack projects do. But this takes time and energy, and it&apos;s understandable that Samsung didn&apos;t want to achieve this in a short time frame.&lt;/p&gt;
&lt;p&gt;There&apos;s a part of the code and architecture that overlaps with Ceilometer and Heat. Ceilometer is becoming a specialized point to store data metrics from any source: so it&apos;s sad, but understandable, that Synaps did not tried to reuse it. Fortunately, Heat is working with Ceilometer to achieve exactly that. This means OpenStack would have only one metrics storage point, used for billing, for monitoring and alarming.&lt;/p&gt;
&lt;p&gt;Therefore, I think Synaps is an implementation of CloudWatch that should be looked at as an inspiration for Heat and Ceilometer to build a better and more integrated solution!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>Ceilometer 0.1 released</title><link>https://julien.danjou.info/blog/ceilometer-0-1-released/</link><guid isPermaLink="true">https://julien.danjou.info/blog/ceilometer-0-1-released/</guid><description>After 6 months of development, we are proud to release the first release of Ceilometer, the OpenStack Metering project. Ceilometer.</description><pubDate>Fri, 12 Oct 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;After 6 months of development, we are proud to release the first release of &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt;, the &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; Metering project. Ceilometer. This is a first and amazing milestone for us: we follow all other projects by releasing a version for Folsom!&lt;/p&gt;
&lt;p&gt;Using Ceilometer, you should now be able to meter your OpenStack cloud and retrieve its usage to build statistics or bill your customer!&lt;/p&gt;
&lt;p&gt;You can read &lt;a href=&quot;https://lists.launchpad.net/openstack/msg17410.html&quot;&gt;our announcement on the OpenStack mailing list&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Architecture&lt;/h2&gt;
&lt;p&gt;We spent a good amount of time defining and refining &lt;a href=&quot;http://ceilometer.readthedocs.org/en/latest/architecture.html#high-level-description&quot;&gt;our architecture&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/Ceilometer_Architecture-1.png&quot; alt=&quot;Ceilometer_Architecture-1&quot; /&gt;&lt;/p&gt;
&lt;p&gt;One of its important point, is that it has been designed to work without modifying any of the existing core components. Patching OpenStack components in an intrusive way to meter them was not an option for now, simply because we had no legitimacy to do so. This may change in the future, and this will likely be discussed next week during the &lt;a href=&quot;http://www.openstack.org/summit/san-diego-2012/&quot;&gt;OpenStack Summit&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Meters&lt;/h2&gt;
&lt;p&gt;Initially, we defined a bunch of meters we&apos;d like to have for a first release, and in the end, most of them are available. Some of them are still missing, like OpenStack Object Storage (Swift) ones, mainly due to lack of interest from the involved parties so far.&lt;/p&gt;
&lt;p&gt;Anyhow, with this first release, you should be able to meter your instances, their network usage, memory, CPU. Images, networks and volumes and their CRUD operations are metered too. For more detail, you can read the &lt;a href=&quot;http://ceilometer.readthedocs.org/en/latest/measurements.html&quot;&gt;complete list of implemented meters&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;REST API&lt;/h2&gt;
&lt;p&gt;The HTTP REST API has been partially implemented. The provided methods should allow basic integration with a billing system.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dreamhost.com/&quot;&gt;DreamHost&lt;/a&gt; is using Ceilometer in their deployment architecture and coupling it with their billing system!&lt;/p&gt;
&lt;h2&gt;Towards Grizzly&lt;/h2&gt;
&lt;p&gt;We don&apos;t have a clear and established road-map for Grizzly yet.&lt;/p&gt;
&lt;p&gt;We already have a couple of patches waiting in the queue to be merged, like the use of &lt;a href=&quot;https://review.openstack.org/#/c/13989/&quot;&gt;Keystone to authenticate API request&lt;/a&gt; and the &lt;a href=&quot;https://review.openstack.org/#/c/14185/&quot;&gt;removal of Nova DB access&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On my side, these last days I&apos;ve been working on a small debug user interface for the API. Ceilometer API server will return this interface if your do an API request from a browser (i.e. requesting &lt;code&gt;text/html&lt;/code&gt; instead of &lt;code&gt;application/json&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/ceilometer-debug-interface.png&quot; alt=&quot;ceilometer-debug-interface&quot; /&gt;&lt;/p&gt;
&lt;p&gt;I hope this will help to discover Ceilometer API more easily for new comers and leverage it to build powerful tools!&lt;/p&gt;
&lt;p&gt;Anyhow, we have tons of idea and work to do, and I&apos;m sure the upcoming weeks will be very interesting. Also, we hope to be able to become an OpenStack incubated project soon. So stay tuned!&lt;/p&gt;
</content:encoded><category>openstack</category></item><item><title>Ceilometer, the OpenStack metering project</title><link>https://julien.danjou.info/blog/openstack-metering-ceilometer/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-metering-ceilometer/</guid><description>For the last months, I&apos;ve been working on a metering project for OpenStack, so it&apos;s time to talk a bit about it.</description><pubDate>Fri, 27 Jul 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;For the last months, I&apos;ve been working on a metering project for &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt;, so it&apos;s time to talk a bit about it.&lt;/p&gt;
&lt;p&gt;OpenStack is a growing cloud platform providing IaaS. A problem easily identified by everyone building a public cloud platform is that nothing is provided to retrieve the platform usage data. Some data are available in some places, but not everything is, and you have to do a lot of processing from the various components to get something useful in the end. But in order to bill customers that are using your public cloud platform, you need to do his.&lt;/p&gt;
&lt;p&gt;In this regard, a lot of companies running public OpenStack based infrastructure wrote their own solution to cover this functional areas, and to become able to bill theirs customers.&lt;/p&gt;
&lt;p&gt;To avoid everybody doing and maintaining such a stack in their corners, the &lt;a href=&quot;http://launchpad.net/ceilometer&quot;&gt;Ceilometer&lt;/a&gt; has been created.&lt;/p&gt;
&lt;p&gt;The project aims to cover the metering aspect of the OpenStack components, pulling usage data from every components and storing them into a single place. It then offer a retrieving point for this data via a REST API.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://wiki.openstack.org/EfficientMetering&quot;&gt;initial specifications&lt;/a&gt; have been written in April this year, and actual implementation started in May. The project is currently worked on by me, Dreamhost and Canonical.&lt;/p&gt;
&lt;p&gt;We already have designed &lt;a href=&quot;http://wiki.openstack.org/EfficientMetering/ArchitectureProposalV1&quot;&gt;an architecture&lt;/a&gt; that we are implementing, and we hope to release a first usable version with Folsom.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/ceilometer-architecture-1.png&quot; alt=&quot;ceilometer-architecture-1&quot; /&gt;&lt;/p&gt;
&lt;p&gt;I did a presentation of this project yesterday at &lt;a href=&quot;http://xlcloud.org/&quot;&gt;XLCloud&lt;/a&gt;, which has been very well received.&lt;/p&gt;
&lt;p&gt;If you are interested in helping us and contributing, feel free to join us during one of our &lt;a href=&quot;http://wiki.openstack.org/Meetings/MeteringAgenda&quot;&gt;weekly IRC meeting&lt;/a&gt; or fix &lt;a href=&quot;https://bugs.launchpad.net/ceilometer&quot;&gt;some bugs&lt;/a&gt;. :-)&lt;/p&gt;
</content:encoded><category>openstack</category><category>talks</category></item><item><title>OpenStack Swift eventual consistency analysis &amp; bottlenecks</title><link>https://julien.danjou.info/blog/openstack-swift-consistency-analysis/</link><guid isPermaLink="true">https://julien.danjou.info/blog/openstack-swift-consistency-analysis/</guid><description>Swift is the software behind the OpenStack Object Storage service.</description><pubDate>Mon, 23 Apr 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://launchpad.net/swift&quot;&gt;Swift&lt;/a&gt; is the software behind the &lt;a href=&quot;http://openstack.org/projects/storage/&quot;&gt;OpenStack Object Storage&lt;/a&gt; service.&lt;/p&gt;
&lt;p&gt;This service provides a simple storage service for applications using &lt;a href=&quot;http://docs.openstack.org/api/openstack-object-storage/1.0/content/&quot;&gt;RESTful interfaces&lt;/a&gt;, providing maximum data availability and storage capacity.&lt;/p&gt;
&lt;p&gt;I explain here how some parts of the storage and replication in Swift works, and show some of its current limitations.&lt;/p&gt;
&lt;p&gt;If you don&apos;t know Swift and want to read a more &quot;shallow&quot; overview first, you can read John Dickinson&apos;s &lt;a href=&quot;http://programmerthoughts.com/openstack/swift-tech-overview/&quot;&gt;Swift Tech Overview&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;How Swift storage works&lt;/h2&gt;
&lt;p&gt;If we refer to the &lt;a href=&quot;http://en.wikipedia.org/wiki/CAP_theorem&quot;&gt;CAP theorem&lt;/a&gt;, Swift chose &lt;strong&gt;availability&lt;/strong&gt; and &lt;strong&gt;partition tolerance&lt;/strong&gt; and dropped &lt;strong&gt;consistency&lt;/strong&gt;. That means that you&apos;ll always get your data, they will be dispersed on many places, but you could get an old version of them (or no data at all) in some odd cases (like some server overload or failure). This compromise is made to allow maximum availability and scalability of the storage platform.&lt;/p&gt;
&lt;p&gt;But there are mechanisms built into Swift to minimize the potential data inconsistency window: they are responsible for data replication and consistency.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://swift.openstack.org/&quot;&gt;official Swift documentation&lt;/a&gt; explains the internal storage in a certain way, but I&apos;m going to write my own explanation here about this.&lt;/p&gt;
&lt;h3&gt;Consistent hashing&lt;/h3&gt;
&lt;p&gt;Swift uses the principle of &lt;a href=&quot;http://en.wikipedia.org/wiki/Consistent_hashing&quot;&gt;consistent hashing&lt;/a&gt;. It builds what it calls a &lt;em&gt;ring&lt;/em&gt;. A ring represents the space of all possible computed hash values divided in equivalent parts. Each part of this space is called a &lt;em&gt;partition&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The following schema (stolen from the &lt;a href=&quot;http://wiki.basho.com/&quot;&gt;Riak&lt;/a&gt; project) shows the principle nicely:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/riak-ring.png&quot; alt=&quot;riak-ring&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In a simple world, if you wanted to store some objects and distribute them on 4 nodes, you would split your hash space in 4. You would have 4 partitions, and computing &lt;em&gt;hash(object) modulo 4&lt;/em&gt; would tell you where to store your object: on node 0, 1, 2 or 3.&lt;/p&gt;
&lt;p&gt;But since you want to be able to extend your storage cluster to more nodes without breaking the whole hash mapping and moving everything around, you need to build a lot more partitions. Let&apos;s say we&apos;re going to build 210 partitions. Since we have 4 nodes, each node will have &lt;code&gt;210 ÷ 4 = 256&lt;/code&gt; partitions. If we ever want to add a 5th node, it&apos;s easy: we just have to re-balance the partitions and move 1⁄4 of the partitions from each node to this 5th node. That means all our nodes will end up with &lt;code&gt;210 ÷ 5 ≈ 204&lt;/code&gt; partitions. We can also define a &lt;em&gt;weight&lt;/em&gt; for each node, in order for some nodes to get more partitions than others.&lt;/p&gt;
&lt;p&gt;With 210 partitions, we can have up to 210 nodes in our cluster. Yeepee.&lt;/p&gt;
&lt;p&gt;For reference, Gregory Holt, one of the Swift authors, also wrote &lt;a href=&quot;http://greg.brim.net/page/building_a_consistent_hashing_ring.html&quot;&gt;an explanation post about the ring&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Concretely, when building one Swift ring, you&apos;ll have to say how much partitions you want, and this is what this value is really about.&lt;/p&gt;
&lt;h3&gt;Data duplication&lt;/h3&gt;
&lt;p&gt;Now, to assure availability and partitioning (as seen in the &lt;em&gt;CAP theorem&lt;/em&gt;) we also want to store replicas of our objects. By default, Swift stores 3 copies of every objects, but that&apos;s configurable.&lt;/p&gt;
&lt;p&gt;In that case, we need to store each partition defined above not only on 1 node, but on 2 others. So Swift adds another concept: zones. A zone is an isolated space that does not depends on other zone, so in case of an outage on a zone, the other zones are still available. Concretely, a zone is likely to be a disk, a server, or a whole cabinet, depending on the size of your cluster. It&apos;s up to you to choose anyway.&lt;/p&gt;
&lt;p&gt;Consequently, each partitions has not to be mapped to 1 host only anymore, but to N hosts. Each node will therefore store this number of partitions:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;number of partition stored on one node = number of replicas × total number of partitions ÷ number of node
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We split the ring in 210 = 1024 partitions. We have 3 nodes. We want 3 replicas of data.&lt;br /&gt;
→ Each node will store a copy of the full partition space: &lt;code&gt;3 × 210 ÷ 3 = 210 = 1024 partitions&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;We split the ring in 211 = 2048 partitions. We have 5 nodes. We want 3 replicas of data.&lt;br /&gt;
→ Each node will store &lt;code&gt;211 × 3 ÷ 5 ≈ 1129 partitions&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;We split the ring in 211 = 2048 partitions. We have 6 nodes. We want 3 replicas of data.&lt;br /&gt;
→ Each node will store &lt;code&gt;211 × 3 ÷ 6 = 1024 partitions&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Three rings to rule them all&lt;/h3&gt;
&lt;p&gt;In Swift, there is 3 categories of thing to store: &lt;em&gt;account&lt;/em&gt;, &lt;em&gt;container&lt;/em&gt; and &lt;em&gt;objects&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;An &lt;strong&gt;account&lt;/strong&gt; is what you&apos;d expect it to be, a user account. An account contains &lt;strong&gt;containers&lt;/strong&gt; (the equivalent of Amazon S3&apos;s buckets). Each container can contains user-defined key and values (just like a hash table or a dictionary): values are what Swift call &lt;strong&gt;objects&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Swift wants you to build 3 different and independent rings to store its 3 kind of things (&lt;em&gt;accounts&lt;/em&gt;, &lt;em&gt;containers&lt;/em&gt; and &lt;em&gt;objects&lt;/em&gt;).&lt;/p&gt;
&lt;p&gt;Internally, the two first categories are stored as &lt;a href=&quot;http://www.sqlite.org/&quot;&gt;SQLite&lt;/a&gt; databases, whereas the last one is stored using regular files.&lt;/p&gt;
&lt;p&gt;Note that this 3 rings can be stored and managed on 3 completely different set of servers.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/openstack-swift-storage-1.png&quot; alt=&quot;openstack-swift-storage-1&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Data replication&lt;/h2&gt;
&lt;p&gt;Now that we have our storage theory in place (accounts, containers and objects distributed into partitions, themselves stored into multiple zones), let&apos;s go the replication practice.&lt;/p&gt;
&lt;p&gt;When you put something in one of the 3 rings (being an account, a container or an object) it is uploaded into all the zones responsible for the ring partition the object belongs to. This upload into the different zones is the responsibility of the &lt;em&gt;swift-proxy&lt;/em&gt; daemon.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/openstack-swift-replication.png&quot; alt=&quot;openstack-swift-replication&quot; /&gt;&lt;/p&gt;
&lt;p&gt;But if one of the zone is failing, you can&apos;t upload all your copies in all zones at the upload time. So you need a mechanism to be sure the failing zone will catch up to a correct state at some point.&lt;/p&gt;
&lt;p&gt;That&apos;s the role of the &lt;em&gt;swift-{container,account,object}-replicator&lt;/em&gt; processes. This processes are &lt;strong&gt;running on each node part of a zone&lt;/strong&gt; and replicates their contents to nodes of the other zones.&lt;/p&gt;
&lt;p&gt;When they run, they walk through all the contents from all the partitions on the whole file system and for each partition, issue a special &lt;em&gt;REPLICATE&lt;/em&gt; HTTP request to all the other zones responsible for that same partition. The other zone responds with information about the local state of the partition. That allows the replicator process to decide if the remote zone has an up-to-date version of the partition.&lt;/p&gt;
&lt;p&gt;In case of account and containers, it doesn&apos;t check at the partition level, but check each account/container contained inside each partition.&lt;/p&gt;
&lt;p&gt;If something is not up-to-date, it will be pushed using &lt;em&gt;rsync&lt;/em&gt; by the replicator process. This is why you&apos;ll read that the replication updates are &lt;em&gt;&quot;push based&quot;&lt;/em&gt; in Swift documentation.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;## Pseudo code describing replication process for accounts
## The principle is exactly the same for containers
for account in accounts:
    # Determine the partition used to store this account
    partition = hash(account) % number_of_partitions
    # The number of zone is the number of replicas configured
    for zone in partition.get_zones_storing_this_partition():
        # Send a HTTP REPLICATE command to the remote swift-account-server process
        version_of_account = zone.send_HTTP_REPLICATE_for(account):
        if version_of_account &amp;lt; account.version()
            account.sync_to(zone)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This replication process is &lt;em&gt;O(number of account × number of replicas)&lt;/em&gt;. The more your number of account will increase and the more you will want replicas for your data, the more the replication time for your accounts will grow. The same rule applies for containers.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;## Pseudo code describing replication process for objects
for partition in partitions_storing_objects:
    # The number of zone is the number of replicas configured
    for zone in partition.get_zones_storing_this_partition():
        # Send a HTTP REPLICATE command to the remote swift-object-server process
        verion_of_partition = zone.send_HTTP_REPLICATE_for(partition):
        if version_of_partition &amp;lt; partition.version()
            # Use rsync to synchronize the whole partition
            # and all its objects
            partition.rsync_to(zone)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This replication process is &lt;em&gt;O(number of objects partitions × number of replicas)&lt;/em&gt;. The more your number of objects partitions will increase, and the more you will want replicas for your data, the more the replication time for your objects will grow.&lt;/p&gt;
&lt;p&gt;I think this is something important to know when deciding how to build your Swift architecture. Choose the right number the number of replicas, partitions and nodes.&lt;/p&gt;
&lt;h2&gt;Replication process bottlenecks&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://julien.danjou.info/content/images/03/copy-cat.jpg&quot; alt=&quot;copy-cat&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;File accesses&lt;/h3&gt;
&lt;p&gt;The problem, as you might have guessed, is that to replicate, &lt;strong&gt;it walks through every damn things&lt;/strong&gt;, things being accounts, containers, or object&apos;s partition hash files. This means it need to open and read (part of) a every file your node stores to check that data need or not to be replicated!&lt;/p&gt;
&lt;p&gt;For accounts &amp;amp; containers replication, this is done every 30 seconds by default, but it will likely take more than 30 seconds as soon as you hit around 12 000 containers on a node (see measurements below). Therefore you&apos;ll end up checking consistency of accounts &amp;amp; containers on each all node &lt;strong&gt;all the time&lt;/strong&gt;, using obviously a lot of CPU time.&lt;/p&gt;
&lt;p&gt;For reference, &lt;a href=&quot;http://web.archive.org/web/20120903043209/http://alexyang.sinaapp.com/?p=115&quot;&gt;Alex Yang also did an analysis&lt;/a&gt; of that same problem.&lt;/p&gt;
&lt;h3&gt;TCP connections&lt;/h3&gt;
&lt;p&gt;Worst, the HTTP connections used to send the &lt;em&gt;REPLICATE&lt;/em&gt; commands are not pooled: a new TCP connection is established each time something has to be checked against the same thing stored on a remote zone.&lt;/p&gt;
&lt;p&gt;This is why you&apos;ll see in the &lt;a href=&quot;http://swift.openstack.org/deployment_guide.html&quot;&gt;Swift&apos;s Deployment Guide&lt;/a&gt; this lines listed&lt;br /&gt;
under &lt;a href=&quot;http://swift.openstack.org/deployment_guide.html#general-system-tuning&quot;&gt;&quot;general system tuning&quot;&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;## disable TIME_WAIT.. wait..
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_tw_reuse=1

## double amount of allowed conntrack
net.ipv4.netfilter.ip_conntrack_max = 262144
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In my humble opinion, this is more an ugly hack than a tuning. If you don&apos;t activate this and if you have a lot of containers on your node, you&apos;ll end up soon with thousands of connections in &lt;em&gt;TIME_WAIT&lt;/em&gt; state, and you indeed risk to overload the IP conntrack module.&lt;/p&gt;
&lt;h3&gt;Container deletion&lt;/h3&gt;
&lt;p&gt;We also should talk about container deletion. When a user deletes a container from its account, the container is &lt;strong&gt;marked as deleted&lt;/strong&gt;. And that&apos;s it. It&apos;s not deleted. Therefore the SQLite database file representing the container will continue to be checked for synchronization, over and over.&lt;/p&gt;
&lt;p&gt;The only way to have a container permanently deleted is to &lt;strong&gt;mark an account as deleted&lt;/strong&gt;. This way the &lt;em&gt;swift-account-reaper&lt;/em&gt; will delete all its containers and, finally, the account.&lt;/p&gt;
&lt;h2&gt;Measurement&lt;/h2&gt;
&lt;p&gt;On a pretty big server, I measured the replications to be done at a speed of around 350 {account,container,object-partitions}/second, which can be a real problem if you choose to build a lots of partition and you have a low &lt;em&gt;number_of_node ⁄ number_of_replicas&lt;/em&gt; ratio.&lt;/p&gt;
&lt;p&gt;For example, the default parameters runs the container replication every 30 seconds. To check replication status of 12 000 containers stored on one node at the speed of 350 containers/seconds, you&apos;ll need around 34 seconds to do so. In the end, you&apos;ll never stop checking replication of your containers, and the more you&apos;ll have containers, the more your &lt;strong&gt;inconsistency window will increase&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Until some of the code is fixed (the HTTP connection pooling probably being the &quot;easiest&quot; one), I warmly recommend to choose correctly the different Swift parameters for your setup. The replication process optimization consists in having the minimum amount of partitions per node, which can be done by:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;decreasing the number of partitions&lt;/li&gt;
&lt;li&gt;decreasing the number of replicas&lt;/li&gt;
&lt;li&gt;increasing the number of node&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For very large setups, some code to speed up accounts and containers synchronization, and remove deleted containers will be required, but this does not exist yet, as far as I know.&lt;/p&gt;
</content:encoded><category>openstack</category><category>python</category></item><item><title>Ten years as a Debian developer</title><link>https://julien.danjou.info/blog/ten-years-as-a-debian-developer/</link><guid isPermaLink="true">https://julien.danjou.info/blog/ten-years-as-a-debian-developer/</guid><description>Ten years ago, I joined the Debian project as a developer.</description><pubDate>Fri, 24 Feb 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Ten years ago, I joined the &lt;a href=&quot;http://www.debian.org&quot;&gt;Debian&lt;/a&gt; project as a developer.&lt;/p&gt;
&lt;p&gt;At that time, I was 18 and in my first year at university, hanging out with the &lt;a href=&quot;http://tuxfamily.org&quot;&gt;TuxFamily&lt;/a&gt; system administrators, which included 3 french Debian developers (sjg, igenibel and creis).&lt;/p&gt;
&lt;p&gt;I was learning Debian packaging while working on &lt;a href=&quot;http://vhffs.org&quot;&gt;VHFFS&lt;/a&gt;, and decided to package one or two non-yet-packaged software for Debian. My friends pushed me into the &lt;a href=&quot;http://nm.debian.org&quot;&gt;NM process&lt;/a&gt;, and &lt;a href=&quot;https://nm.debian.org/nmstatus.php?email=acid@hno3.org&quot;&gt;less than 2 months later&lt;/a&gt; I was a Debian developer. One have to admit that back in the days, the NM process was really fast if you were able to reply to the questions quickly. :-) I think I became the youngest developer among Debian&apos;s ones.&lt;/p&gt;
&lt;p&gt;That was my first steps in a Free Software project, and it was really exciting.&lt;/p&gt;
&lt;p&gt;In 10 years, I&apos;ve been doing a lot of different things for Debian. Sure, I&apos;ve been using it all the years long, but let&apos;s recap a bit what I did, from what I recall.&lt;/p&gt;
&lt;p&gt;My first Debian only project was &lt;a href=&quot;http://packages.debian.org/apt-build&quot;&gt;apt-build&lt;/a&gt; around 2003, and later &lt;a href=&quot;http://packages.debian.org/rebuildd&quot;&gt;rebuildd&lt;/a&gt; in 2007.&lt;/p&gt;
&lt;p&gt;I built the &lt;a href=&quot;https://alioth.debian.org/projects/pkg-xen/&quot;&gt;Xen packaging team&lt;/a&gt; in 2005, I&apos;ve been a Stable Release Manager for a year in 2006, and did heavy bug squashing to release Etch that same year.&lt;/p&gt;
&lt;p&gt;I also was an &lt;a href=&quot;https://nm.debian.org/whoisam.php&quot;&gt;Application Manager in 2006&lt;/a&gt; and managed the application of 2&lt;br /&gt;
Debian developers (&lt;a href=&quot;https://nm.debian.org/nmstatus.php?email=joseparrella%40cantv.net&quot;&gt;Jose Parrella&lt;/a&gt; and &lt;a href=&quot;https://nm.debian.org/nmstatus.php?email=debian%40damianv.com.ar&quot;&gt;Damián Viano&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;I admit I&apos;ve been less active in Debian after 2007, mainly because I was busy working on &lt;a href=&quot;http://awesome.naquadah.org&quot;&gt;awesome&lt;/a&gt;, &lt;a href=&quot;http://www.gnu.org/software/emacs/&quot;&gt;GNU Emacs&lt;/a&gt; and others software.&lt;/p&gt;
&lt;p&gt;Since 2011, I joined the &lt;a href=&quot;http://alioth.debian.org/projects/openstack/&quot;&gt;OpenStack packaging team&lt;/a&gt; and I&apos;m working on OpenStack on a (almost) daily basis.&lt;/p&gt;
&lt;p&gt;I don&apos;t know how many packages I touched, managed or updated, but that should be one or two hundreds. I still maintain &lt;a href=&quot;http://qa.debian.org/developer.php?login=acid&quot;&gt;53 of them&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After all, the adventure has been really pleasant, and I had the chance to work with and meet fabulous and smart people. I always liked this project and what it&apos;s trying to do.&lt;/p&gt;
&lt;p&gt;After all these years, I&apos;m definitively staying! See you in another 10 years, folks! :)&lt;/p&gt;
</content:encoded><category>debian</category><category>openstack</category><category>emacs</category><category>awesome</category></item><item><title>My OpenStack work</title><link>https://julien.danjou.info/blog/my-openstack-work/</link><guid isPermaLink="true">https://julien.danjou.info/blog/my-openstack-work/</guid><description>Like I already wrote here last week, I&apos;ve been heavily working on OpenStack for the last weeks.</description><pubDate>Fri, 16 Dec 2011 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Like I already wrote here last week, I&apos;ve been heavily working on &lt;a href=&quot;http://openstack.org&quot;&gt;OpenStack&lt;/a&gt; for the last weeks.&lt;/p&gt;
&lt;p&gt;My first assignment was to package OpenStack for Debian. The packages already present in unstable were mainly done by &lt;a href=&quot;http://thomas.goirand.fr/&quot;&gt;Thomas Goirand&lt;/a&gt;, who based its work on the one done in &lt;a href=&quot;http://ubuntu.com&quot;&gt;Ubuntu&lt;/a&gt;. Therefore, the packages where not in a very good shape for Debian.&lt;/p&gt;
&lt;p&gt;Today Ghe Rivero and I (members of the &lt;a href=&quot;https://alioth.debian.org/projects/openstack&quot;&gt;OpenStack Debian packaging team&lt;/a&gt;) managed to push the &lt;a href=&quot;https://launchpad.net/openstack/+milestone/essex-2&quot;&gt;OpenStack Essex 2 milestone&lt;/a&gt; into unstable with great success. You can now test and deploy OpenStack Essex 2 very easily!&lt;/p&gt;
&lt;p&gt;Packaging OpenStack &lt;a href=&quot;https://review.openstack.org/#dashboard,1669&quot;&gt;made me write several patches&lt;/a&gt;, mainly related to packaging, patches which were all accepted and merged by upstream. This is nice because most of the OpenStack Debian packages lost their &lt;em&gt;debian/patches&lt;/em&gt; directories now!&lt;/p&gt;
&lt;p&gt;Finally, I&apos;ve finished to implement one blueprint I really missed: the &lt;a href=&quot;https://blueprints.launchpad.net/nova/+spec/support-kvm-boot-from-iso&quot;&gt;ability to boot from an ISO image&lt;/a&gt; using &lt;a href=&quot;http://libvirt.org&quot;&gt;libvirt&lt;/a&gt;. The code still needs a review, but it should be included in the Essex 3 milestone if everything&apos;s right.&lt;/p&gt;
</content:encoded><category>openstack</category><category>debian</category></item><item><title>New job, new blog</title><link>https://julien.danjou.info/blog/new-job-new-blog/</link><guid isPermaLink="true">https://julien.danjou.info/blog/new-job-new-blog/</guid><description>It has been a while since I blogged but I&apos;ve been very busy, with my new job and this new blog!  New job! I quitted my job last September, and found another one that I started in October. I&apos;m now the</description><pubDate>Wed, 07 Dec 2011 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;It has been a while since I blogged but I&apos;ve been very busy, with my new job and this new blog!&lt;/p&gt;
&lt;h2&gt;New job!&lt;/h2&gt;
&lt;p&gt;I quitted my job last September, and found another one that I started in October. I&apos;m now the lead developer of &lt;a href=&quot;http://www.enovance.com/fr/produits-solutions/opencloud-opensource/enovance-labs&quot;&gt;eNovance Labs&lt;/a&gt;, where I work on the &lt;a href=&quot;http://openstack.org/&quot;&gt;OpenStack&lt;/a&gt; project. So far, this allowed me to contribute heavily to the &lt;a href=&quot;https://alioth.debian.org/projects/openstack&quot;&gt;Debian packaging of OpenStack&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;New blog!&lt;/h2&gt;
&lt;p&gt;In the meantime, I took some time to redesign my personal homepage and this blog, which is now using &lt;a href=&quot;https://github.com/hyde/hyde&quot;&gt;Hyde&lt;/a&gt;, the &lt;a href=&quot;http://python.org&quot;&gt;Python&lt;/a&gt; equivalent of &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;, which is in &lt;a href=&quot;http://www.ruby-lang.org/&quot;&gt;Ruby&lt;/a&gt;. Since I dislike Ruby (sorry), I preferred to use a Python based generator, and I admit Hyde is really cool.&lt;br /&gt;
Since I really suck at Web design, this one is obviously based on &lt;a href=&quot;http://twitter.github.com/bootstrap/&quot;&gt;Twitter&apos;s bootstrap&lt;/a&gt;&lt;/p&gt;
</content:encoded><category>career</category><category>openstack</category><category>python</category><category>debian</category></item></channel></rss>