Saturday, July 22, 2017

Queues vs Distributed logs (tech pill)

TL;DR A queue is a good choice when you have one kind of job to do that you can divide in independent smaller jobs that can execute in any order and a distributed log is a good choice when you have several kinds of jobs or functionalities for the same stream of data (logs, events, etc.).

Queues vs Distributed Logs

This blog post tries to explain the typical use for Queues and for Distributed Log, but of course, a system usually uses these solutions in combination or in other ways. But I will try to summarize the usual use because some times I see some confusion about how we can use these interesting solutions.

Queue



Use a Queue when:

  • You want to distribute workload between workers for the same feature. 
  • Each message can represent a job and don't require knowledge about other messages at the queue.

Pros:

  • Easy to implement.
  • Unlimited/Easy horizontal scalability.
  • Fault tolerance is very easy to implement (time out and re-queue of the message).
  • Allow easy balance between latency (time at the queue + processing time) and the cost of the concurrent workers.

Cons:

  • The order is not guaranteed.
  • Each message can only be consumed by one worker for one feature.
  • Usually, we can have duplicates.

Examples

  • Asynchronous processing of email requests.
  • Processing of independent batch jobs.

Alternatives and related variations

  • Queues with guaranteed order (Ex: SQS FIFO).
  • TTL for messages in the Queue.
  • Queues with a max amount of queued messages.

Implementations:

  • AWS SQS, RabbitMQ

Distributed Log


Use a Distributed Log when:

  • You want to execute several functionalities for the same stream of ordered data (log aggregation, statistics calculation, event sourcing, store streams of information, etc.)
  • You want that the data corresponding to the same partition key is processed in order by the same worker instance.

Pros:

  • Allow several functionalities for the same data. Each functionality knows what is his own offset.
  • If two or more functionalities are at the same offset, they can be sure that have seen the same messages in the same order.
  • Having a guaranteed order,  at least at the partition key level, allow design simple solution for calculating statistics, event sourcing, near real-time calculation, etc. 
  • You can add new functionalities that use/process the same data with any change in the actual system (Open/Closed principle: open for extension but closed for modification).

Cons:

  • Usually, the order of the messages is preserved for each partition key only.
  • Scalability using sharding/partitioning.
  • More difficult than queues.
  • Difficult to have balanced shards/partitions (hot partition problem).

Examples

  • Log aggregation / distribution / statistics calculation from the logs.
  • Event streaming to allow event sourcing.

Implementations:

  • AWS Kinesis, Kafka

References:


Saturday, July 15, 2017

Honey badger Team / The visual history II


Disclaimer: I am experimenting with different formats to create presentations, blog post, and other documents, mixing sketch noting and using index cards... I will appreciate your feedback.

In the previous post about the history of the Honey Badger Team, the focus was to define the context, explain how we evolve our practices, our culture and get our identity as a team. But in parallel, there is a history of tension and lot of work to make this change possible :)

As in any software product development effort, the path was not easy. Perhaps the first blog post doesn't reflect the amount of energy and discussions required to introduce quality and good practices in our team.

During this process (one year and a half), there was tension between different forces: time, scope, learning needs, maintainability, quality, short term value, long term value...

As usual, the main problem is that not all the company have the same experience about technology development so is very difficult to reach a complete alignment for a sustainable strategy...

This was my job or at least part of my job, and for sure, it wasn't easy and requires a lot of energy, patience, and continuous learning...  Learn about how to sell ideas, learn about how to get some margin, learn about how to generate trust...
I also tried to teach about agile concepts, lean, collaboration, etc.

During part of this journey we also had a CTO that helped us to defend the need for change, so even if the change process was already there, is true that he helped me to accelerate the process a little bit (for example he negotiated a percentage of time to improve our test network). He also helped me to translate technical concepts to the C level.


The main problem, as in any complex system that involves humans, was the communication. Seems that we use a completely different vocabulary and even language. I try to solve this miscommunication trying to learn about our business, gain trust and adapting our message to the actual understanding of the technology.


There was an inflection point in the process that could cause the collapse of the team. We started to work as a team, introduce the XP practices and improve day by day, but in parallel, there was some misalignments at the company level that was introducing a lot of structure, a lot of levels and an environment not very aligned with our spirit of collaboration...
This problem drained the motivation of the tech team, that feel very good improvements regarding our internal processes but feel the friction generated by this amount of structure and the misalignment.

This process ended with some deep changes at the company level, but during this period of time, we lost great engineers and great colleagues :(  Personally, this was a rough time for me.
Seems that we have overcome that problem and that we are in the right direction, adding new honey badgers to the team.

In summary, the first blog post explained the internal changes but this doesn't reflect the whole history... in parallel, there was a huge effort to improve the communication between each group in the company, deal with all the typical tensions, and a lot of small changes to introduce a more agile culture in times of huge uncertainty...

And I can assure that this path was not easy... required patience and energy...   and this are a scarce resource :)

Reference:



Monday, July 10, 2017

Charlas interesantes (Junio/Julio 2017)


Estas son algunas charlas muy interesante que he visto últimamente:

Saturday, July 08, 2017

Honey badger Team / The visual history (I)

Disclaimer: I am experimenting with different formats to create presentations, blog post, and other documents, mixing sketch noting and using index cards... I will appreciate your feedback.

I prepared these notes for the past AOS 2017, but finally, the session was not selected... The initial idea was to describe our process for creating an agile software development team and create a discussion to identify next steps to expand our agile culture to the rest of the organization


Honey Badger Team / The visual history



In the beginning, there was a bunch of developers at TheMotion starting to create the product. But there was no process and the "established" tendency was to try to optimize the resource usage. As we already know, optimizing the resource usage have some serious problems:
  1. People are not resources :) (so this not work very well outside some simple industrial processes/pipelines that don't involve humans)
  2. This process generates busy work but not necessarily good outcomes.
  3. To optimize the resource usage, we need:
    1. Push until all of the resources are 100% used
    2. To create buffers to have everybody busy
    3. Generate SILOs / Specialization for each skill (front end, backend, video)
The result of this process was:
  • An incredible high bus factor
  • Stress and bad quality code and practices
  • Tons of WIP/inventory and unneeded features as we develop based on how is available (frontend, backend...)
I arrived at this point to the company... There was a Funny party going on :)

One thing was clear (at least for me), using a Lean and Agile approach can help to create a product in a startup.... It also can help to improve the overall frustration :)

I am completely biased because I like the agile mindset... but I sincerely think that in a startup the agile approach is the right choice:  Fail (agile is not recipe for success) and learn as fast as possible :)

For me, Agile is a set of values and principles, not a methodology and two pillars:
  • A healthy culture focused on people (collaboration, respect, teamwork, creativity...) 
  • Looking for quality and technical excellence (for example XP practices are a great starting point).

So my first target was introducing quality and technical excellence to be capable of delivering software in small cycles (days instead of weeks)... My idea was to introduce the culture at the same time that we improve our technical capacity. Any software developer is more open to a new ideas if he shows improvements in the code and in his day to day work. :)

But how can we detect if we are in the right path?
I discovered that a good KPI for measure these improvements was how much anxiety was generated in each team member when we change the frequency of a development event (deploy, merge, etc...)
For example, the target was:
  • Deploys frequency, from 1 a month, to several per day (the deploy is not an event).
  • Integration frequency, from branches that last forever to trunk based development.
  • Feedback time:
    • For review, from code reviews and pull request to pairing and continuous review.
    • Subsecond for unit tests.
    • Seconds for integration tests.
    • Minutes for production monitoring.


But How can we improve the quality and our technical capacity???

For me, the response is agile development, XP practices and modern agile... In summary being professionals and pragmatic delivering software. And mentoring is the only way I know to introduce this technical practices....


Initialy, I was the only one that started to send the message about XP, Craftmanship, cloud native, etc... At the same time, we were trying to improve the day-to-day work improving the infrastructure and the base platform.

We, as a team, was making improvements, but learning TDD or pairing have an important entry barrier so we need external help with experience teaching this practices (by doing of course).


To improve the "mentoring power", the collaboration of Modesto San Juan and Alfredo Casado from Carlos Ble y Asociados (now codesai) was key. They help us to improve our TDD and to introduce other XP practices (shared ownership, pairing, etc). At this point, our internal alignment started to be evident.

The first day that I detected that the mentoring effort was having a profound effect was when one developer, talking aloud, explained what Modesto or Alfredo would say about his code, and immediately he started to improve the code :-)

Another key point was that from day 0, we assumed that everybody wants to make a good job so the smarter approach to improve is to "Make easy to make the right thing". Instead on focus in preaching how the things should be done and instead of forcing to do the things in a certain way, our focus was on creating an awesome tooling and platform that make very easy to create microservices, include instrumentation, metrics...  We pushed very hard to have an automated infrastructure and a very good tooling.... This includes rolling deploys, standard makefiles, a devbox (now deprecated), containers, etc.a great monitoring.

With this platform and this tooling, it was easy to introduce a DevOps culture, with microservices and improve our deployment cadence day by day.

An important note here.... during this process, the most important factor was to use an agile process and make small improvements, with low risk in parallel to the normal development...



Right now, our practices include, continuous delivery (several times a day), automatic tests (TDD in the way but not the default option yet), simple design, immutable infrastructure, infrastructure as code, collective ownership and we work as a high-performance team with our own identity and a high level of trust….
We have a lot of things to improve, including our quality at the front end (software design and practices), more solid understanding and usage of the XP practices, and so on... but I can say that the agile mindset, the learning culture, and the eager to improve, are already there. :)

We continue our journey, improving continuously...


At a company level, we passed for some periods with lack of alignment, but this is changing very fast and seems that in the next months we will have very clear goals at a company level. This is great and can help us with our next challenge... Expand the agile mindset to the rest of the organization...

A final note:

IMHO now that we are capable of creating/evolving a software product, is the right time to expand this culture to the rest of the organization... I see a lot of times that there is a huge effort trying to introduce the agile mindset at the company level but without having a solid technical capacity, and I think that this is a huge mistake for software/tech based companies. In such cases, the story usually goes as follows:  Huge effort to transmit the benefits of the agile mindset, everybody is very excited, the change begins, but the core of the systems is not capable of generating software at a sustainable pace, the technical debt begins to grow without control,  and the product collapse... The cultural change fails, and everybody thinks that Agile doesn't work...

The explanation is easier than that: You don't know how to make software. So first, learn how to make software and later you can introduce other parts of agile. (See: the two pillars of agile).

A culture of Agile software development with a good quality is a prerequisite for introducing Agile at a company level for software based companies.


References:


Thanks:

  • To Jorge Jardines for the fast feedback and some improvements
  • To the Honey Badger team :)


Sunday, July 02, 2017

AOS Agile Open Space 2017 Segovia

Disclaimer: I am experimenting with different formats to create presentations, blog post, and other documents, mixing sketch noting and using index cards... I will appreciate your feedback.




The past 23,24th of June I was at the Agile Open Space at Segovia (AOS)... This is my sixth consecutive year going to the AOS (you can see almost all of my past experiences at http://www.eferro.net/search/label/aos). I like this unconference because is a great excuse to see friends and enjoy great conversations with other "agilistas".

The Agile community in Spain organizes two events, the CAS that is a regular conference and the AOS that is an Open Space. The AOS instead or being the classic conference with a clear separation between speakers and attendees, is more like a meeting of community members... something like a community of practice of the members of Agile Spain.

As the community evolves, the AOS evolves also and reflect this change. Over the years I've been seeing how the community is shifting from a community of software developers to a community focused on organizational change and agile outside the software products.

I have come to the conclusion that in order to not feel frustration I should not go to AOS as a software developer. :)

I will write a blog post about this change and the relation between software development, agile and craftsmanship.

The Sessions


Sessions I attended or participated:
  • Parallel Changes: I facilitate this session. The idea was to explain why is important to be capable of making huge changes in software using a sequence of multiple small changes with low risk. The first 10min I explained why this is a good idea and showed some samples. The rest of the session was working in groups and presenting other examples or related problems/challenges to solve. I will create a specific blog post for this.
  • Cómo combatir el efecto Pokemon: Interesting session about a usual problem about having a lot of tasks that can be only done by some people of the team. A classical problem is for UX/design tasks or with some low level debugging stuff or DB optimization. Lot of people at that session had this problem, for all the tasks they had… :( The reason is simple, they allow working each member of the team individually and don't rotate… they allow rambos, heroes, and other kinds of “good developers” that can’t work in teams…. (I mean BAD developers). If we think that developing is a team effort, there is an easy solution to avoid this problem: XP, multidisciplinary teams, pairing, mob programming, share ownership… Is easy, hire people to work in teams and help them to work as a team.
  • Facilitación gráfica / Visual thinking: A good session about how to express drawing and how to take notes… This was an introductory talk and have three parts, an ice breaking dynamic, some tips to draw the most common shapes (faces, titles, people, etc) and a final dynamic to collaboratively make a visual dictionary with difficult words as transparency, value, and so on… very abstract words that are difficult to represent. This was interesting because each one tries to express these words drawing so you can take some of the ideas…. I am trying to improve my visual thinking and sketch noting skills so this session helps me in that path….
  • Disciplina positiva y Agile Kids: I was especially interested in this session.. because for me is so natural the agile mindset and continuous improvement that is easy to think that is also useful for personal life and kids education. I attended to this presentation with my wife to take notes for future family steps… The session was a presentation of the experience of two parents following the advice from the book: Agile Kids ( niños agiles )
  • Slow: The session of this session was about how we can use some techniques from the Slow movement to improve our day-to-day capacity and life. We experience some exercises, lot of them related with mindfulness. https://www.slideshare.net/twallet/pequeas-tcnicas-para-un-da-slow
  • Autoexigencia de los equipos: (https://twitter.com/artzis) The format of this session was a Fishbowl. The topics were, should we expect that the team has self-demand / self-discipline? why? how? and the individual? The conversation was very interesting and has some good insights about motivation, learning and hiring the right people…



Final conclusions and Notes

The sessions are important but for me the best of this AOS at Segovia was:

  • I went to Segovia with my family... my wife and my daughter... :)  this was great and have an important effect regarding our internal organization as a family... We even are testing using a kanban board.
  • A lot of my coworkers come and enjoyed the power of the self-organization and the agile mindset... I am quite sure that this will have a strong effect on the culture of our company. (this is part of my plan to conquer the world) :)
  • I enjoyed a lot talking with old friends, reinforcing relations and even creating new ones... Not bad for an introvert software developer.



Thanks


I have special thanks to the organization, Delia Estebaranz, Javier Garcia Garrido from agiletorrezno for making this conference a pleasure for going with the family. Having the opportunity of enjoying the conference as a family was GREAT.

Lot of thanks for the volunteers.

Also thanks to the sponsors of the conference for making it possible: Deiser, USTGlobal, Jerónimo Palacios, Thinking With You, Ticketea, Agilar, Biko2, Flywire, Look Forward Consulting, Runroom, Kairos, Colegio Profesional de Ingenieros en Informática de Castilla y León, Segovia Activa, Kleer...





Other interesting blog posts about this AOS edition: