An introduction to Microservices

Lately has been a lot of debating and hype around Microservices. But what are microservices? Why is there that amount of noise around a term? Hope this introductory blog post can help you understand what is a microservice and introduce you into the topic.

Photo by Glen Carrie

What are Microservices?

Paraphrasing Martin Fowlers in his article about Microservices, “microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API”. Although he’s making a reference to HTTP APIs, it’s not the only mechanism to communicate services, but it’s becoming the most used due to the growing popularity of the web services.

It’s pretty common to see people getting confused about libraries and microservices when reading about it for first time. Don’t worry, it happened to all of us. They are different in that libraries are running in the same process than the main application, and they communicate using in-process function calls. Another common mistake is to confuse an architecture based on microservices with a modular architecture. While they are similar they’re not exactly the same. It’s true that microservices are implicitly modular but it’s false that every modular architecture uses microservices. In fact, most of the modular applications are monolithic.

As developers, sometimes we tend to organize our code around technical features, such as frontend, backend, helpers, libraries, etc. Microservices are organized around business capabilities and that’s why it’s often confused with modules of a modular application. It means each service performs a business feature and inside this service you can organize the code as you desire. You can think in a service as an independent application which is able to run alone and has value by itself.

“Smart endpoints and dumb pipes” — with that sentence microservice community tries to summarize how the application should be structured in terms of communication. The smart part of the application should reside in the services (endpoints) and communication should be done as simple as possible, using REST APIs or message queues, such as RabbitMQ or ZeroMQ. In fact, message queues is the second most used approach for communicating services, especially those ones that run long-time operations or are not high priority. For instance, if a service needs to communicate with another one that just sends emails, message queues are a nice choice.

Pros and cons

Microservice term has been out there for years but lately, as web services grow, it’s going to generate some hype around it. It’s not the ultimate solution for all your application architectures, because of this you should be aware of the pros and cons.

> Evolutionary Design

This is probably one of the biggest advantages of the microservices architecture. As your application grows it’s easy to plug-in new services with new business capabilities. As most of the software applications are business-driven and market changes so fast you will end up loving this advantage.

> Multiple Programming Languages

Every time you start an application you have to decide in which language you’ll build it. Sometimes you choose one depending on your skills and sometimes depending on the best choice for the application in question. As time goes on and your application grows you end up having to stick to the selected programming language and related technologies you chose. Then you realize that some new features will perform better in another language/framework. Or even worst, that technology doesn’t have a library to use with your programming language. Here is where microservices can help a lot. As every service is a decoupled and independent application you can use a different language/technology for each one, depending on your needs. So, for instance, your application is written in Ruby on Rails and you want to integrate a chat using Node.js.

> Multiple Database Types

Similarly as described before, you can have different types of database in your application. For instance, let’s say your application uses MySQL to handle most of the relational data but for a chat you may prefer to use a time series database such as InfluxDB. I’m not a DB expert, don’t take my word literally on which kind of DB is the best for a chat, it’s just an example.

> Independent Deployable Units

As I said before, a microservice is an independent application and, as such, it can be deployed independently. It means that every time you need to change a service it’s not necessary to re-deploy the entire application. It will make you feel more self confident when you’re about to deploy.

> System Resilience

As a decoupled and distributed system, when some of the services fails (and it will do) just a feature of your application will fail, but the application will be still usable. Moreover, you can have a service monitoring the rest of the services and if one of them fails it will reboot the service.

> Easy to Scale

Imagine your application is allowing to upload images and apply effects over them. Some of these effects may consume a lot of memory and you don’t want it to affect to the rest of the application. Using microservices you can easily add memory (or other resources) to the server/process running this service. It’s easy to scale resources depending on the service needs.

> Deal with Too Many Services

When you’re deciding in how many services you want to split your application it’s easy to get crazy with the service boundaries and end up having lots of services you’ll have to develop and maintain. It will be so easy to introduce unnecessary complexity into the system, and therefore errors. Be careful with that.

> Code Duplication

The same way is nice to have the ability of using different programming languages, it’s also very easy to have the same code in different languages. When it happens within the same language some people suggest to use this code as a library but then you’ll be introducing coupling.

> Testing

Testing is a pro and a con. While it’s fairly easy to test a single service it can be a pain to test the whole system and its integration, since every time you want to test the entire application you have to configure and set every service up.

> Asynchronicity

Asynchronous operations introduces complexity in its coordination and make it really difficult when you need synchronous or transactional operations.

Many of these are not really a disadvantage but just a lack of tools for automating or monitoring. As a friend of mine says: “We need a tool!”.

Should I be using Microservices today?

That’s a great question I often heard. I would start by analyzing the application needs carefully. My advice is that it’s better to start small and easy but without disregarding that your application can grow and you don’t want to suffer it, but enjoy it. Be pragmatic not dogmatic. It’s true that there are well known practices that will work for your application but don’t be afraid to adapt them to your needs.

A common approach that I also follow is to start the application monolithic but modular. After this, start separating these modules into services as you really need it. It will not be easy, as every in-process call you made you’ll have to rewrite as a Remote Procedure Call, you’ll need to mount a new server/process with its own resources and configure them, but believe me, it will be easier than having to start with a tightly-coupled application.

Form Follows Function

This title is an excerpt of a nice quote from Louis Sullivan:

“Whether it be the sweeping eagle in his flight, or the open apple-blossom, the toiling work- horse, the blithe swan, the branching oak, the winding stream at its base, the drifting clouds, over all the coursing sun, form ever follows function, and this is the law. Where function does not change, form does not change.” — Louis Sullivan

***
by Francisco Méndez Vilas
Full Stack Developer at Redbooth

References

Does your startup need a financial cofounder?

Many business schools tell us that having a balanced mix of professional profiles in a startup team is key to maximize your chances of success.

This is true. However, you need to know what skills does your startup need in order to validate a value proposition. Since starting up nowadays involves development of some kind, a CTO is key.

You also need to know how you will sell your product…

Sayings such as “my product/service is so good that it will sell by itself” are the first indicator that you don’t know how to sell. No sales, no business. That’s why the other key figure is someone who can sell to the client, someone who gets people to your site and understands how to drive them towards the cart checkout. I am talking about the CMO or the Growth Hacker,depending on the business.

So far you can make things and sell them, but the third key role in a startup is the BUSINESS one. This figure tends to be the leader, the one with the vision, the one who has a clear idea on how to turn the concept into a profitable enterprise, the one who can manage all the resources (specially the time) and make things happen.

Is this business entrepreneur the finance person? Not necessarily. It always comes in handy to have someone who can deal with reports, taxes, banking and other administrative stuff, because these are things that assure the survival of a business that sells. Again, no sales, no business. A startup needs to find at least one revenue source with a lifetime value higher than the acquisition costs, with enough market size and market share.

Finance person, do you need one?

When a startup has validated its business model and can then start to think like a company, is in this moment when it is key to have a finance person: someone who can deal with the administrative tasks, give business performance visibility to managers and provide trustability to shareholders.Nowadays, finding a qualified person for this tasks is not as hard as looking after the three entrepreneurial types mentioned above: the CTO, the CMO / Growth Hacker and the Business/Product oriented person.

Therefore, a CFO is not essential on the first stages of a startup, although it may be convenient, of course.

In this post, I have indirectly stated that the ideal number of entrepreneurs is three. They also need to complement one another, not clones with repeated profiles. Why three?

  • To avoid ties in decision making.
  • To offer different points of view.
  • It allows entrepreneurs to meet and work easily with each other.
  • Entrepreneurs can keep a big stake in the business, so that they really feel owners.
  • Startups need entrepreneurs rather than employees to be able to go the extra mile.

Rails Girls are back in town!

An interview with Laura Fernandez, Rails Girl + back end developer atCamaloon.

Rails Girls is a non-profit movement founded by Linda Liukas and Karri Saarinen in Helsinki, where the 1st workshop took place in 2010. Since then, this peer-run (and free!) workshop, that aims to “give tools for women to build their ideas”, has been organized by local teams in over than 200 cities, attracting more and more girls to the programming world.

In Spain, this Rails Girls movement is sparking. Their workshops have already taken place in Madrid (2012), Córdoba (2014) and Gran Canaria (2015). In Barcelona, the 1st one took place two years ago. And recently, a group of volunteers thought the time had arrived to organize a second one! And here we go with the 2nd free Rails Girls workshop in town, taking place on March 28 + 29 at FabLab.

One of those volunteers is Laura Fernández, backend developer at Camaloon and ruby on rails lover. We have interviewed her to have a look behind the scenes of the Rails Girls movement and the Barcelona group of volunteers.

itnig: Laura, can you explain a bit more what is Rails Girls, how it works and what is the ultimate motivation of this initiative?

Laura: The first time time I heard about Rails Girls, I loved the idea. A few months ago I met a group of girls who work on IT and ‘the question’ came up: why are so few girls in development, engineering and technology? Sadly, we don’t really know the reason. So, with this initiative we want to share our experience as tech-girls. We would like to teach all girls some basic things about our daily job as web developers and offer them help and support to those who are making their first steps in this world, or thinking on doing a career twist.

i: How many people are behind the Barcelona Rails Girls chapter? And can you explain us a bit more about your role?

L: This edition of Rails Girls Barcelona 2015 is being organized by a mixed group of volunteers. I say mixed because we are all girls but also we have a boy, Andreas! And I also say mixed because each of us is from a different country. So, it has been really inspiring and enriching every time we have spent together figuring out how this is going to be.

Not all of us are developers though, but we all love technology. Paulina was the first one who explained us the idea, because she collaborated a few times with the Rails Girls team in Poland. Andreas also has experience organizing previous Rails Girls’ events. María is our marketing person. She is full of ideas and deals with media & sponsors like a true ninja.

The rest of us, PiliSilvia and me, we are Rails developers and we all have done our best looking for coaches and sponsors.

i: I am a girl and I want to learn to code. What is Ruby on Rails and why should I start with this programming framework?

L: Ruby on Rails is an open source web application framework written in Ruby. It was first published in 2005 and new releases are published nearly each year. It is used in most startups and it is said that more than 600.000 sites all over the world are running in Ruby on Rails.

My background was software development, but anyone, from any background, who gives it a try finds it easy to learn and understand. There are no boring or confusing configuration files and the ruby syntax is really easy to get!

Rails Girls Barcelona · March 28 + 29

i: Any Rails Girls workshop lasts a weekend. Can you explain a bit more how is the weekend structured?

L: The installation party takes place the first. This means that we will help everyone setting up all software needed in their computers. After that, we will start with some theoretical explanations and coding, step by step. We would like to create a comfortable atmosphere in which everyone will be welcomed to ask any doubt. We will also have some enlightening talks from interesting people…sshhh…sorry I can’t tell you more 😉

i: What can someone with absolute zero knowledge about programming create something in less than 48h?

L: It is not so important what you are going to develop, but what you are going to learn. After the workshop you will understand how web development works, you will have the ability and the resources to start learning by your own. However, a lot of things can be done in 48hours, of course! A basic app will be deployed including some forms to interact with, a database, the application of some designs… All depends on you! Are you prepared? 😉

i: Can men also attend this workshop?

L: Yes, of course! The only requirement is that they have to attend with a girl. Unfortunately, there won’t be enough spots for everyone, so we are giving priority to girls.

i: A lot of women will be reading this post right now (I hope ^^). What would you tell them to encourage them to sign up?

L: Come on!!! Your are going to learn something new. This is your opportunity: everything you always wanted to know but you never dared to ask!!

Was Laura convincing enough?
Great! You can sign up here!
See you on Saturday, March 28 at FabLab!

Interviewing Emilia Vila, co-founder & CEO at Agroptima

Although technology arrived later to agriculture than to other industries, the fields are catching up. In recent years, more startups and venture capitalists have set their sights on this ancient industry, and innovation is already changing the rules of the game for farmers. Fact is that agriculture is one of the biggest markets in the world and all the agricultural process clearly have a big margin to benefit from data science, wireless technologies and software in the cloud.

In Spain, one of the startups that is already providing solutions to manage the daily life of a farm without farmers having to step off the tractor is Agroptima.

To know a bit more about this startup and how the agricultural industry is being disrupted with new software tools we have interviewed Emilia Vila, co-founder and CEO at Agroptima.

itnig: Hi Emilia! You have experience launching different startups in different industries. Why did you decided to startup in agriculture with Agroptima?

Emilia: In a previous start-up (Delizr.de) my co-founder and me talked to farmers very often. We realised how frustrated they were when it came to optimize their crops and analyze their performance. They had poor software tools and no data.

We also saw an increasing amount of data coming from IoT devices: drones, sensors and machines. We realised we could build the Google Analytics for farmers. And that is what Agroptima is, short and sweet 🙂

We were also super motivated to have the chance to revolutionize a vast industry, which faces so many challenges in this century. For example, do you know how we will feed the world by 2050? We will have to increase food production by 70%. With Agroptima we know we can have a great impact in this world and that motivates us everyday.

i: In your opinion, and although the market is big enough, why agriculture has not been attractive to entrepreneurs as fast as other industries?

E: I think it is because most of the entrepreneurs come from the urban world and they focus on solving problems they encounter or products they want to use.

i: You say that Agroptima’s goal is “to dramatically increase agriculture competitiveness through new technologies”. How are you achieving this goal?

E: We are achieving this goal by focusing on the farmer. We are not focusing on intermediaries or other people. We believe that farmers are the key piece to revolutionize agriculture and we are providing them with the right tools.

The first version of Agroptima is already in the market and it is already helping farmers optimize their farms, save time, paper and easily comply with the law. The current version of Agroptima is a mobile app and webapp that allows farmers to keep track of their activities and manage their entire farm resources. This simple tool allows them to get rid of paper and to start gathering data that can be used to make better decisions on crop rotations, plantations or usage of specific products like herbicides, fertilizers, etc.

i: You started Agroptima on February 2014 and launched the beta of your product in September 2014. What happened during that period of time? Could you recall the main steps of the process of creating your product?

E: We have built a team integrated by engineers and a group of farmers. These 6 farmers are very modern, tech friendly and have experience using farm software in the past. We listened to their needs and essentially made the best product upon them. Co-creation is the key.

Before launching Agroptima, farmers tested it in the fields. We scaled step by step with batches of new farmers and finally now Agroptima is already available to anyone and more and more farmers are using it to optimize their farms every day.

i: Farming is mostly dominated by men. How do they handle the fact that the boss of Agroptima is a woman?

E: You are right, actually, farming is mostly dominated by men as it is a hard physical job. However, I am lucky that our community of farmers is very professional and I have never experienced an uncomfortable situation due to gender differences.

i: How about your team? Your co-founders are Ferran Gascon (CTO) and Anisia Tardà (Agricultural Engineer). Did you knew each other before Agroptima or how did you came up to start a business together?

E: I started Delizr.de with Ferran, an online gourmet marketplace, and I have worked with him for a long time. During this experience is where we identified the opportunity of Agroptima.

Meeting Anisia came later thanks to a contact we had in common. We shared a common goal: to bring tech to agriculture and to help farmers be more efficient. When you are so passionate about a common goal, the connection is very strong. In our case, we formed the perfect team (tech, agrotech, business) and we had a great opportunity in front, so we just seized it!

Agroptima’s Team + the farmers (beta testers).

i: As far as I know, you haven’t closed any funding round yet. How have you financially survived until now?

E: We have raised funds thanks to the 9 innovation contests that we have won all around Europe and we have chipped in personal savings.

i: Are you planning to open a funding round in the near future?

E: Yes, we are now actively looking for smart money to help us revolutionize agriculture faster.

i: What is your long term vision for Agroptima and what are your next steps?

E: Our next step is to laser focus on improving what we have and to connect with the farming community. Our long term vision, is to achieve the “interconnected farm” where all the elements and devices are connected and the farmer can manage and optimize the farm from Agroptima.

i: In your opinion, what is the future of agriculture? Will it become a hyper-technified sector with field’s evolution being supervised by drones?

E: For us, the future of agriculture is the involvement of the farmer in technology. Therefore we focus on providing the best technology to the farmer (not intermediaries, advisors, etc.).

We are hyped everyday by new gadgets, sensors, robots, drones… Those technologies will be successful as long as farmers want to use them, as long as they are solving an important pain. If that’s the case, I am sure they will help shape the future of agriculture.

There is no doubt farming activities will have a higher degree of automation and therefore big data, drones and internet of things can be key to provide the inputs necessary to make this possible.

Interviewing Marc García, co-founder & CEO at Viuing

Last Wednesday, February 18 Marc García, co-founder & CEO at Viuing, was interviewed at the 2nd CEO talks of the year, organized at itnig by our colleagues from Delvy Law & Finance.

Below you can find the video of the interview, which was conducted in Spanish by Josep Navajo, lawyer and co-founder at Delvy.

About Marc García and Viuing:

Marc García describes himself as “an entrepreneurial spirit with a determined attitude and passionated about my job”.

But before launching his own business, Marc worked for two big corporations: 8 years at Ferrovial as sales area manager, and almost 9 years at Yamaha as coordinator of water vehicles, recreational vehicles and power products.

When asked about these experiences, Marc assess them very differently: “At Ferrovial I was very junior. I stayed because they offered me to lead a project — Don Piso — and I mainly learned about dealing with customers. But Yamaha was my top job experience”.

At Yamaha Marc learned how to design, evaluate and re-allocate budgets, and how to manage teams in a multinational environment. And during a F1 race, he and his co-founder, Sergio Palomino, had the idea of Viuing: “Standing at the grandstands we realized that we were actually missing most of the race, and we came up with the idea of a device we called Viuing”.

After that, he left his job because “I was a risk lover, as I guess all entrepreneurs are, who deeply believed in his project”. But, what is most important, Marc knew there was a market for his product!

And in October 2013, Viuing was born: a device for attendants to major events so they can see everything that is going on, even if it happens outside their field of vision. “Viuing is a way to maximize your experience”, says Marc.

Although the product is focused on motor sports’ events, because of the number of attendants, their needs, and for reasons of advertising investments, Marc knows the device can be used in many other events, like big music festivals or even for broadcasting a mass of the Pope.

And as you probably already know, early this year and with only 1 year of life, Viuing managed to close its first round of investment of €700K, which will allow them the “go to market” during 2015.