AnaSaife » cloud native

Tag: cloud native

What is Fail-fast

We are all here to learn something new everyday. Today, I was reading about cloud native again. (on this link) I heard so often about “fail-fast systems”. I did my own research about it and wanted to share some ideas on it.

There are a few principles about fail-fast systems and code. We will talk about all.

Fail-fast Systems:

Fail-fast modules and components are often used in situations where failure in one component might not be visible until it leads to failure in another module.

Finding the cause of a failure is easier in a fail-fast system, because the system reports the failure with as much information as possible as close to the time of failure as possible. In a fault-tolerant system, the failure might go undetected, whereas in a system that is neither fault-tolerant nor fail-fast the failure might be temporarily hidden until it causes some seemingly unrelated problem later.

Developers also refer to fail-fast code to a code that tries to fail as soon as possible at variable or object initialization. In OOP, a fail-fast designed object initializes the internal state of the object in the constructor, launching an exception if something is wrong (vs allowing non-initialized or partially initialized objects that will fail later due to a wrong “setter”). The object can then be made immutable if no more changes to the internal state are expected. In functions, fail-fast code will check input parameters in the precondition. In client-server architectures, fail-fast will check the client request just upon arrival, before processing or redirecting it to other internal components, returning an error if the request fails (incorrect parameters, …). Fail-fast designed code decreases the internal software entropy, and reduces debugging effort.

Fail-fast Development & Code

There is an another terminology about it. Its called “test driven development”. Lets go on and explain it on some coding example.

Lets assume that you are reading keyword from a property file. And you are sending requests via TwitterAPI.


public String getKeyword() {
String keyword = getProperty("twitter.api.search.query.keyword");
if(keyword == null)
return String.EMPTY;
return keyword;
}

What if we apply fail-fast principle In our method?


public String getKeyword() {
String keyword = getProperty("twitter.api.search.query.keyword");
if(StringUtis.isEmpty(keyword))
throws new NullReferenceException("keyword can't be null or empty");
return keyword;
}

To be continued with examples, pros and cons.

What is Cloud Native?

Hey all, this is my first English blog. You will also see me when im blogging about cloud development and micro services architecture in English.

First blog is about Cloud Native Architecture. I will be sharing notes about my development environment, tools and principles. See you around.

Cloud-native is an approach to building and running applications that fully exploits the advantages of the cloud computing delivery model. Cloud native is about how applications are created and deployed, not where.

cloud native

DevOps is the collaboration between software developers and IT operations with the goal of constantly delivering high-quality software that solves customer challenges. It creates a culture and environment where building, testing and releasing software happens rapidly, frequently, and more consistently.

https://pivotal.io/cloud-native

How Does Cloud Native Work?
The fundamentals of Cloud Native have been described as container packaging, dynamic management and a Microservices-oriented architecture, which sounds like a lot of work. What does it actually mean and is it worth the effort? We believe Cloud Native promotes five architectural principles:

Use infrastructure-as-a-service: run on servers that can be flexibly provisioned on demand.
Design systems using, or evolve them towards, a microservices architecture: individual components are small and decoupled.
Automate and encode: replace manual tasks with scripts or code.
Containerize: package processes with their dependencies making them easy to test, move and deploy.
Orchestrate: abstract away individual servers in production using off-the-shelf management and orchestration tools.

Conclusion

I think Cloud Native Architecture is all about reducing risk and going fast. Code like a startup, deploy like if there is no tomorrow. (Einstein)