[:es]Este post es parte de una serie acerca Service Fabric.
- Introducción a Service Fabric
- Creando un servicio WCF para Azure Service Fabric
En el principio (en un tiempo no muy lejano) fue el servidor local y la vida del desarrollador era un caos. El equipo de IT (si no había uno, entonces el desarrollador) era responsable de que el servidor en donde se montaba una aplicación estuviera funcionando como debía. Era su culpa si esto no pasaba.
Después, con el aprovechamiento de la virtualización vino la nube y trajo, entre sus ventajas más notorias, el darnos la oportunidad de culpar transferir la responsabilidad a alguien más
¿Qué tiene que ver todo esto con este post? Microsoft Azure Service Fabric es una opción de Platform as a Service construida desde cero para soportar aplicaciones en la nube distribuidas, a gran escala y con alta disponibilidad. Inició como una propuesta para bases de datos en la nube (CloudDB) y actualmente es usada en productos estrella de Microsoft como Cortana, Skype for Business, Power BI, SQL Azure, etc.
Sus principales venajas estan en la facilidad que da a los desarrolladores en manejar elementos que van más allá de la funcionalidad como
- Actualizaciones escalonadas
- Log
- Monitoreo y telemetría de los servicios
- Manejo de fallas
- Seguridad
De este modo el desarrollador puede enfocar sus esfuerzos y atencion en el código.
Microservicios
Aunque es normalmente asociado con microservicios, las ventajas de Service Fabric pueden aprovecharse en aplicaciones multi-capa, APIs, etc. Pero, ¿qué es son los microservicios?. Aunque no hay una definición estándar, normalmente se caracterizan por separar la funcionalidad de una aplicación en partes más pequeñas. Estas partes son versionadas de manera independiente, pueden ser de cualquier tecnología, escalables y orientados resolver una parte concreta del problema que se está atacando. Es importante dejar claro que monolítico no es malo ni microservicios bueno. Todo depende del escenario y contexto.
Al ser distribuidos de manera independiente en nodos (contenedores, servidores, máquinas virtuales) diferentes agrupados dentro de un cluster en donde se lleva a cabo el proceso de réplica y partición, cada microservicio puede escalarse según sus necesidades propias.
Cluster
Service Fabric puede correr del mismo modo en Microsoft Azure, otras nubes como AWS e incluso en nubes privadas, ya sea en Linux o Windows. Incluso al momento del desarrollo, los componentes utilizados son iguales, lo que facilita el moverse de un entorno a otro cuando sea necesario. Esto es debido a que los componentes estan pensados para ser estandres y no es necesario realizar modificaciones de acuerdo al ambiente en donde se ejecute. El cluster provee un nivel de abstracción entre la aplicación y la infraestructura en que se ejecuten.; es un conjunto de nodos con los componentes instalados y configurados para comunicarse entre sí. Las principales características del cluster son
- Puede soportar miles de nodos
- Puede cambiarse dinámicamente
- Es una unidad de aislamiento
Servicios
Service fabric provee un conjunto de servicios para facilitar la administración:
Cluster manager
Encargado de las operaciones referentes al cluster. Por default puede manejarse por medio de REST usando el puerto 19800 en HTTP y con TCP por el puerto 19000 usando Powershell.
Failover manager
Encargado de detectar cuando nuevos nodos se agregan al cluster, cuando se quitan, o cuando alguno falla y rebalancear para asegurar alta disponibilidad de los servicios.
Naming
Mapea los servicios con los endpoints, de manera que puedan comunicarse entre si.
Fault Analysis
Ayuda a introducir fallas a los servicios de manera que puedan probarse escenarios distintos de manera controlada.
Image Store
Contiene los bits de los servicios, el master del cual se hacen las copias que se replican en los nodos.
Upgrade
A cargo de actualizar los componentes de Service Fabric, exclusivamente en Azure.
Programming models
Cuando se trabaja con Service Fabric, se tienen 3 opciones para crear los servicios
Reliable services
Provee una manera simple de integrarse con Service Fabric cuando se crean los servicios, beneficiandose de las herramientas de plataforma.
Reliable actors
Construido sobre Reliable Services, es un framework que trabaja con unidades single-threaded llamadas Actors, basadas en el patrón de diseño con el mismo nombre.
Guest executable
Es sólo eso, un ejecutable que puede publicarse en un cluster sin integrarse completamente con la plataforma; Service Fabric sólo se asegura de que se encuentre corriendo. No importa el lenguaje, por lo que es una buena opción para llevar aplicaciones existentes.
Aplicaciones y servicios
Una aplicación es básicamente un conjunto de servicios, los cuales se definen en el archivo ApplicationManifest.xml; en términos de Service Fabric, a esto se le se denomina Application Type. De él creamos una instancia denominada Application Instance, que es la que contactamos en tiempo de ejecución, muy similar al concepto de clase e instancia en programación orientada a objetos. Del mismo modo pasa con Service Type y Service instance, además de que se compone de 3 partes: código, datos y configuración.
Cada uno de estos elementos tiene su propia versión, es decir puedo tener la versión 2.1.1 de mi Aplicación que se compone de 1 servicio con versión 1.0.0.
Con esto termina la introduccion; estos son los conceptos básicos de Service Fabric en los que nos basaremos para los siguientes tutoriales.[:en]This post is part of Service Fabric series
- Introduction to Service Fabric
- Creating a WCF Service for Azure Service Fabric
In the beginning (not so far away) it was the local server, and developer’s life was a chaos. IT team (if existing, otherwise the developer itself) was responsible of ensuring the server where the applications was installed worked as needed. It was his fault if this didn’t happen.
Later, whit the use of virtualization the cloud came bringing the ability of give us the chance of blaming transfer the responsibility to someone else.
What does all this have to do with this post? Microsoft Azure Service Fabric is a Platform as a Service option, built from scratch for supporting cloud, distributed, high-scale and high-availability applications. It started as a proposal for cloud databases (CloudDB) and currently is being used on rockstar Microsoft Products like Cortana, Skype for Business, Power BI, SQL Azure, etc.
Its main advantages are in the easiness given to developers for managing elements that are beyond functionality, like
- Rolling updates
- Logging
- Monitoring and telemetry from the services
- Failures
- Security
This way developer can focus all his efforts and attention in coding.
Microservices
Even though it is normally associated with microservices, Service Fabric benefits can be useful in multi-layer applications, APIs, etc. But, what are microservices? Although there is no standard definition, they are normally identified by spliting application functions in small parts. These parts are independently versioned, written in any language or technology and oriented to solve a concrete situation from the problem is intending to tackle. It is important to be clear that monolithic is not bad neither microservices is good; it all depends of the scenario and context.
By being distributed independently in different nodes (containers, servers, virtual machines) within a cluster where the replication and partition process is performed, each microservice can be scaled according to its own needs.
Cluster
Service Fabric can run the same on Microsoft Azure, other clouds providers like AWS and even on private clouds, no matter if it is Linux or Windows. Even at development time, the required components are exactly the same, what makes really easy to move from one environment to the other when it is needed. This is because the components where thought to be standard and is not needed to make modifications according to the environment where it will be executed.
The cluster is a set of nodes components installed and configured to communicate each other; it provides an abstraction level between the application and the infraestructure where it’s executed. The main cluster abilites are
- Supporting thousand of nodes
- Dynamic change
- Isolation unit
Infrastructure Services
Service fabric provides a set of services to help with infrastructure management
Cluster manager
In charge of cluster operations. By default it can be managed using REST through port 19800 with HTTP and with TCP through port 19000 using Powershell.
Failover manager
In charge of detecting when new nodes are added to the cluster, when they are removed, or when a fail occurs in order to re-balance for high availabiliy.
Naming
Maps the services with the endpoints, so the can communicate each other.
Fault Analysis
Helps you to introduce failures to your services so you can test different scenarios in a controlled manner.
Image Store
Contains the actual bits of the services, the master used for creating the copies that are replicated on the nodes.
Upgrade
In charge of updating Service Fabric components, exclusively on Azure.
Programming models
When working with Service Fabric, you have 3 options for creating your services
Reliable services
Provides a simple way for integrate with Service Fabric when creating your services, benefiting from the platform tools.
Reliable actors
Built on top of Reliable Services capabilities, it’s a framework that works with single-threaded units called Actors, based on the design pattern with the same name.
Guest executable
It’s just that, an executable that you can deploy to service fabric cluster, without fully integrating with the platform; Service Fabric just ensures the exec stays up and running. The programming language doesn’t matter, so it is a good option for existing applications.
Application and services
An applications is basically a set of services, defined in ApplicationManifest.xml file; in Service Fabric terms, we name it Application Type. Based on this type we create an Application Instance, that is the one we hit at runtime; this is very similar to the class and instance concepts in OOP. The same goes for Service Type and Service instance; additionaly it’s composed by 3 parts: code, data and configuration.
Each of this elements has its own version, so we can have an Application with version label 2.1.1 composed by one service with version 1.0.0.
That’s it for now; we’ve covered Service Fabric concepts that will be used for our next tutorials.[:]
Leave a Reply