<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: anjireddy k</title>
    <description>The latest articles on DEV Community by anjireddy k (@anji4246).</description>
    <link>https://dev.to/anji4246</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F218372%2Fc089c5cc-3367-4ce4-9aee-02d04844aa20.jpg</url>
      <title>DEV Community: anjireddy k</title>
      <link>https://dev.to/anji4246</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anji4246"/>
    <language>en</language>
    <item>
      <title>Redis vs Memcached — Which one to pick?</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Thu, 24 Sep 2020 15:31:52 +0000</pubDate>
      <link>https://dev.to/anji4246/redis-vs-memcached-which-one-to-pick-5cd4</link>
      <guid>https://dev.to/anji4246/redis-vs-memcached-which-one-to-pick-5cd4</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fOikPfyd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Ag_aU1P2IaXBoqAS6kcxcdg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fOikPfyd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Ag_aU1P2IaXBoqAS6kcxcdg.png" alt=""&gt;&lt;/a&gt;Redis vs Memcached&lt;/p&gt;

&lt;h3&gt;
  
  
  Redis vs Memcached — Which one to pick?
&lt;/h3&gt;

&lt;p&gt;When people talk about the Performance Improvement of an application, the one integral factor that everyone considers is server-side caching. Identifying the right cache provider that suits the requirement is an integral part of adopting the server-side caching.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis&lt;/strong&gt; and &lt;strong&gt;Memcached&lt;/strong&gt; are widely used open-source cache providers across the world. Most of the Cloud providers support Redis and Memcached out of the box.&lt;/p&gt;

&lt;p&gt;In this article, I would like to share similarities and differences between the Redis and Memcached and when do we need to go for Redis or Memcached.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Similarities between Redis vs Memcached&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Key-value pair data stores&lt;/li&gt;
&lt;li&gt;Supports Data Partitioning&lt;/li&gt;
&lt;li&gt;Sub-millisecond latency&lt;/li&gt;
&lt;li&gt;NoSQL family&lt;/li&gt;
&lt;li&gt;Open-source&lt;/li&gt;
&lt;li&gt;Supported by the Majority of programming languages and Cloud providers&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Redis vs Memcached — Feature Comparison&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;DataTypes Supported&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Memcached:&lt;/strong&gt; Supports only simple key-value pair structure&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis:&lt;/strong&gt; Supports data types like strings, lists, sets, sorted sets, hashes, bit arrays, geospatial, and hyper logs.&lt;/p&gt;

&lt;p&gt;Redis allows you to access or change parts of a data object without having to load the entire object to an applicational level, modify it, and then re-store the updated version.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Memory Management&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Memcached:&lt;/strong&gt; Strictly in memory and extended to save key-value details into drive using an extension &lt;a href="https://github.com/memcached/memcached/wiki/Extstore"&gt;extstore&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis:&lt;/strong&gt; Can store the details to disk when the physical memory is fully occupied. Redis has the mechanism to swap the values that are least recently used to disk and the latest values into the physical memory.&lt;/p&gt;

&lt;h4&gt;
  
  
  Data Size Limits
&lt;/h4&gt;

&lt;p&gt;Memcached: Can only store the data of size up to 1 MB&lt;/p&gt;

&lt;p&gt;Redis: can store the data of size up to 512 MB (string values)&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Data Persistence&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Memcached:&lt;/strong&gt; Doesn’t support data persistence&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis:&lt;/strong&gt; Supports data persistence using RDB snapshot and AOF Log persistence policies&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cluster Mode (Distributed caching)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memcached:&lt;/strong&gt; Memcached doesn’t support the distributed mechanism out of the box. This can be achieved on the client-side using a &lt;strong&gt;_consistent hashing _&lt;/strong&gt; strategy&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis:&lt;/strong&gt; Supports distributed cache (Clustering)&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Multi-Threading&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Memcached: Supports multithreading and hence can effectively use the multiple cores of the system&lt;/p&gt;

&lt;p&gt;Redis: Doesn’t support multi-threading&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Scaling&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Memcached:&lt;/strong&gt; can ve vertically scalable. Horizontal scalability is achieved from the client-side only (Using consistent hash algorithm)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis:&lt;/strong&gt; Can be horizontally scalable&lt;/p&gt;

&lt;h4&gt;
  
  
  Data replication
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Memcached:&lt;/strong&gt; Doesn’t support data replication&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis:&lt;/strong&gt; Supports data replication out of the box. Redis Cluster introduces the master node and slave node to ensure data availability. Redis Cluster has two corresponding slave nodes for redundancy.&lt;/p&gt;

&lt;h4&gt;
  
  
  Supported Eviction Policies
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Memcached:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Least Recently Used (LRU)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Redis:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No Eviction (Returns an error if the memory limit has been reached when trying to insert more data)&lt;/li&gt;
&lt;li&gt;All keys LRU (Evicts the least recently used keys out of all keys)&lt;/li&gt;
&lt;li&gt;Volatile LFU (Evicts the least frequently used keys out of all keys)&lt;/li&gt;
&lt;li&gt;All keys random (Randomly evicts keys out of all keys)&lt;/li&gt;
&lt;li&gt;Volatile random (Randomly evicts keys with an “expire” field set)&lt;/li&gt;
&lt;li&gt;Volatile TTL (Evicts the shortest time-to-live and least recently used keys out of all keys with an “expire” field set.)&lt;/li&gt;
&lt;li&gt;volatile LRU (Evicts the least recently used keys out of all keys with an “expire” field set)&lt;/li&gt;
&lt;li&gt;volatile LFU (Evicts the least frequently used keys out of all keys with an “expire” field set)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Transaction Management
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Memcached:&lt;/strong&gt; Doesn’t support transactions&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis:&lt;/strong&gt; Support transactions&lt;/p&gt;

&lt;h3&gt;
  
  
  When to go for Memcached?
&lt;/h3&gt;

&lt;p&gt;Memcached is recommended when dealing with smaller and static data. When dealing with larger data sets, Memcached has to serialize and deserialize the data while saving and retrieving from the cache and require more space to store it. When dealing with smaller projects, it is better to go with the Memcached due to its multi-threading nature and vertical scalability. Clustering requires a considerable amount of effort to configure the infrastructure.&lt;/p&gt;

&lt;h3&gt;
  
  
  When to go for Redis?
&lt;/h3&gt;

&lt;p&gt;Redis supports various data types to handle various types of data. Its clustering and data persistence features make it a good choice for large applications. Additional features like Message queue and transactions allow Redis to perform beyond the cache-store.&lt;/p&gt;

&lt;p&gt;In addition to the above-mentioned features, Redis supports the below features as well&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Message queuing support (Pub/sub)&lt;/li&gt;
&lt;li&gt;snapshots for data archiving/restoring purpose&lt;/li&gt;
&lt;li&gt;Lua scripting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt; Redis and Memcached both can perform very well as a Cache store. Which one to pick varies from project to project.&lt;/p&gt;

&lt;p&gt;It is wise to consider the pros and cons of the providers right from the inception phase to avoid changes and migrations during the project.&lt;/p&gt;

&lt;p&gt;Hope you enjoyed the article. Please share your thoughts/ ideas in the comments box. Thank you for reading it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.redislabs.com/latest/rs/technology-behind-redis-enterprise/"&gt;Redis Enterprise Technical Overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://redis.io/topics/data-types"&gt;Data types - Redis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/elasticache/redis-vs-memcached/"&gt;Redis vs. Memcached | AWS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://medium.com/@Alibaba_Cloud/redis-vs-memcached-in-memory-data-storage-systems-3395279b0941"&gt;https://medium.com/@Alibaba_Cloud/redis-vs-memcached-in-memory-data-storage-systems-3395279b0941&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cache</category>
      <category>redis</category>
      <category>memcached</category>
      <category>microservices</category>
    </item>
    <item>
      <title>12 Factor App Principles and Cloud-Native Microservices</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Thu, 10 Sep 2020 15:37:02 +0000</pubDate>
      <link>https://dev.to/anji4246/12-factor-app-principles-and-cloud-native-microservices-3c6d</link>
      <guid>https://dev.to/anji4246/12-factor-app-principles-and-cloud-native-microservices-3c6d</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4cZe9b4u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AcRE8calR4b0UnvFYyNfTKg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4cZe9b4u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AcRE8calR4b0UnvFYyNfTKg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;12-factor app is a methodology or set of principles for building the scalable and performant, independent, and most resilient enterprise applications. It establishes the general principles and guidelines for creating robust enterprise applications. 12-factor app principles got very popular as it aligns with Microservice principles.&lt;/p&gt;

&lt;p&gt;Below are the 12-factor principles&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Codebase (One codebase tracked in revision control, many deploys)&lt;/li&gt;
&lt;li&gt;Dependencies (Explicitly declare and isolate the dependencies)&lt;/li&gt;
&lt;li&gt;Config (Store configurations in an environment)&lt;/li&gt;
&lt;li&gt;Backing Services (treat backing resources as attached resources)&lt;/li&gt;
&lt;li&gt;Build, release, and Run (Strictly separate build and run stages)&lt;/li&gt;
&lt;li&gt;Processes (execute the app as one or more stateless processes)&lt;/li&gt;
&lt;li&gt;Port Binding (Export services via port binding)&lt;/li&gt;
&lt;li&gt;Concurrency (Scale out via the process model)&lt;/li&gt;
&lt;li&gt;Disposability (maximize the robustness with fast startup and graceful shutdown)&lt;/li&gt;
&lt;li&gt;Dev/prod parity (Keep development, staging, and production as similar as possible)&lt;/li&gt;
&lt;li&gt;Logs (Treat logs as event streams)&lt;/li&gt;
&lt;li&gt;Admin processes (Run admin/management tasks as one-off processes)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Codebase (One codebase tracked in revision control, many deploys)
&lt;/h3&gt;

&lt;p&gt;12-factor app advocates that every application should have its own codebase (repos). Multiple codebases for multiple versions must be avoided. Please do note that having branches would be fine. I.e. For all the deployment environments there should be only one repo but not multiple.&lt;/p&gt;

&lt;p&gt;Multiple apps sharing the same code are a violation of the twelve-factor. Here you should opt-in for shared libraries.&lt;/p&gt;

&lt;p&gt;From the 12-factor app perspective app, deploy meaning the running instance of an app like production, staging, QA, etc. Additionally, every developer has a copy of the app running in their local development environment, each of which also qualifies as a deploy.&lt;/p&gt;

&lt;p&gt;Different versions (the version is like a code change that is available in one environment but not in other) may be active in multiple deploys.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; In Microservices, every service should have its own codebase. Having an independent codebase helps you to easy CI/CD process for your applications.&lt;/p&gt;

&lt;p&gt;Twelve-factor app advocates of not sharing the code between the application. If you need to share you need to build a library and make it as a dependency and manage through package repository like maven.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dependencies (Explicitly declare and isolate the dependencies)
&lt;/h3&gt;

&lt;p&gt;It talks about managing the dependencies externally using dependency management tools instead of adding them to your codebase.&lt;/p&gt;

&lt;p&gt;From the perspective of the java, you can think of Gradle as a dependency manager. You will mention all the dependencies in build.gradle file and your application will download all the mentioned dependencies from maven repository or various other repositories.&lt;/p&gt;

&lt;p&gt;You also need to consider the dependencies from the operating system/ execution environment perspective as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; All the application packages will be managed through package managers like sbt, maven.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In non-containerized environments, you can go for configuration management tools like chef, ansible, etc. to install system-level dependencies.&lt;/li&gt;
&lt;li&gt;For a containerized environment, you can go for dockerfile.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Config (Store configurations in an environment)
&lt;/h3&gt;

&lt;p&gt;Anything that varies between the deployment environments is considered as configuration. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database connections and credentials, system integration endpoints&lt;/li&gt;
&lt;li&gt;Credentials to external services such as Amazon S3 or Twitter or any other external apps&lt;/li&gt;
&lt;li&gt;Application-specific information like IP Addresses, ports, and hostnames, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You should not hardcode any configuration values as constants in the codebase. This is a direct violation of 12-factor app principles.&lt;/p&gt;

&lt;p&gt;12-factor app principles suggest saving the configuration values in the environment variables.&lt;/p&gt;

&lt;p&gt;It advocates the strict separation between the code and configurations. The code must be the same irrespective of where the application being deployed.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;As per “config”, what varies for the environment to the environment must be moved to configurations and managed via environment variables.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; Externalize the configurations from the application. In a microservice service environment, you can manage the configurations for your applications from a source control like git (spring-cloud-config) and use the environment variables to not to maintain the sensitive information in the source control.&lt;/p&gt;

&lt;h3&gt;
  
  
  Backing Services (treat backing resources as attached resources)
&lt;/h3&gt;

&lt;p&gt;As per 12 factor app principles, a backing service is an application/service the app consumes over the network as part of its normal operation.&lt;/p&gt;

&lt;p&gt;Database, Message Brokers, any other external systems that the app communicates is treated as Backing service.&lt;/p&gt;

&lt;p&gt;12-factor app can automatically swap the application from one provider to another without making any further modifications to the code base. Let us say, you would like to change the database server from MySQL to Aurora. To do so, you should not make any code changes to your application. Only configuration change should be able to take care of it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; In a microservice ecosystem, anything external to service is treated as attached resource. The resource can be swapped at any given point of time without impacting the service.&lt;/p&gt;

&lt;p&gt;By following the interfaced based programming allow to swap the provider dynamically without impact on the system. Plug-in based implementation also helps you to support multiple providers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build, release, and Run (Strictly separate build and run stages)
&lt;/h3&gt;

&lt;p&gt;The application must have a strict separation between the build, release, and run stages. Let us understand each stage in more detail.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build stage:&lt;/strong&gt; transform the code into an executable bundle/ build package.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Release stage:&lt;/strong&gt; get the build package from the build stage and combines with the configurations of the deployment environment and make your application ready to run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run stage:&lt;/strong&gt; It is like running your app in the execution environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can use CI/CD tools to automate the builds and deployment process. Docker images make it easy to separate the build, release, and run stages more efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Processes (execute the app as one or more stateless processes)
&lt;/h3&gt;

&lt;p&gt;The app is executed inside the execution environment as a process. An app can have one or more instances/processes to meet the user/customer demands.&lt;/p&gt;

&lt;p&gt;As per 12-factor principles, the application should not store the data in in-memory and it must be saved to a store and use from there. As far as the state concern, your application should store the state in the database instead of in memory of the process.&lt;/p&gt;

&lt;p&gt;Avoid using sticky sessions, using sticky sessions are a violation of 12-factor app principles. If you would store the session information, you can choose redis or memcached or any other cache provider based on your requirements.&lt;/p&gt;

&lt;p&gt;By following these, your app can be highly scalable without any impact on the system&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; By adopting the stateless nature of REST, your services can be horizontally scaled as per the needs with zero impact. If your system still requires to maintain the state use the attached resources (redis, Memcached, or datastore) to store the state instead of in-memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Port binding (Export services via port binding)
&lt;/h3&gt;

&lt;p&gt;The twelve-factor app is completely self-contained and doesn’t rely on runtime injection of a webserver into the execution environment to create a web-facing service. The web app exports HTTP as a service by binding to a port, and listening to requests coming in on that port.&lt;/p&gt;

&lt;p&gt;In short, this is all about having your application as a standalone instead of deploying them into any of the external web servers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; Spring boot is one example of this one. Spring boot by default comes with embedded tomcat, jetty, or undertow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Concurrency (Scale out via the process model)
&lt;/h3&gt;

&lt;p&gt;This talks about scaling the application. Twelve-factor app principles suggest to consider running your application as multiple processes/instances instead of running in one large system. You can still opt-in for threads to improve the concurrent handling of the requests.&lt;/p&gt;

&lt;p&gt;In a nutshell, twelve-factor app principles advocate to opt-in for horizontal scaling instead of vertical scaling.&lt;/p&gt;

&lt;p&gt;(vertical scaling- Add additional hardware to the system&lt;/p&gt;

&lt;p&gt;Horizontal scaling — Add additional instances of the application)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; By adopting the containerization, applications can be scaled horizontally as per the demands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Disposability (maximize the robustness with fast startup and graceful shutdown)
&lt;/h3&gt;

&lt;p&gt;The twelve-factor app’s processes are disposable, meaning they can be started or stopped at a moment’s notice. When the application is shutting down or starting, an instance should not impact the application state.&lt;/p&gt;

&lt;p&gt;Graceful shutdowns are very important. The system must ensure the correct state.&lt;/p&gt;

&lt;p&gt;The system should not get impacted when new instances are added or takedown the existing instances as per need. This is also known as system disposability.&lt;/p&gt;

&lt;p&gt;Systems do crash due to various reasons. the system should ensure that the impact would be minimal and the application should be stored in a valid state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; By adopting the containerization into the deployment process of microservices, your application implicitly follows this principle at a maximum extent. Docker containers can be started or stopped instantly. Storing request, state, or session data in queues or other backing services ensures that a request is handled seamlessly in the event of a container crash.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dev/prod parity (Keep development, staging, and production as similar as possible)
&lt;/h3&gt;

&lt;p&gt;The twelve-factor methodology suggests keeping the gap between development and production environment as minimal as possible. This reduces the risks of showing up bugs in a specific environment.&lt;/p&gt;

&lt;p&gt;The twelve-factor developer resists the urge to use different backing services between development and production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; This is an inherent feature of the Microservices that is run using the containerization techniques.&lt;/p&gt;

&lt;h3&gt;
  
  
  Logs (Treat logs as event streams)
&lt;/h3&gt;

&lt;p&gt;Logs become paramount in troubleshooting the production issues or understanding the user behavior. Logs provide visibility into the behavior of a running application.&lt;/p&gt;

&lt;p&gt;Twelve-factor app principles advocate separating the log generation and processing the log's information. From the application logs will be written as a standard output and the execution environment takes care of capture, storage, curation, and archival of such stream should be handled by the execution environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; In Microservices, observability is the first-class citizen. Observability can be achieved through using APM tools (ELK, Newrelic, and other tools) or log aggregations tools like Splunk, logs, etc.&lt;/p&gt;

&lt;p&gt;By following the above-mentioned guidelines all you need is to debug an issue is to go to the central dashboard of your tool and search for it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Admin processes (Run admin/management tasks as one-off processes)
&lt;/h3&gt;

&lt;p&gt;There is a number of one-off processes as part of the application deployment like data migration, executing one-off scripts in a specific environment.&lt;/p&gt;

&lt;p&gt;Twelve-factor principles advocates for keeping such administrative tasks as part of the application codebase in the repository. By doing so, one-off scripts follow the same process defined for your codebase.&lt;/p&gt;

&lt;p&gt;Ensure one-off scripts are automated so that you don’t need to worry about executing them manually before releasing the build.&lt;/p&gt;

&lt;p&gt;Twelve-factor principles also suggest using the built-in tool of the execution environment to run those scripts on production servers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices:&lt;/strong&gt; Containerization also helps here to run the one-off processes as a task and shutdown automatically one done with the implementation.&lt;/p&gt;

&lt;p&gt;That’s all for today. Hope you have enjoyed the article. Please share your thoughts or ideas or improvements in the below comments box.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://12factor.net/build-release-run"&gt;https://12factor.net/build-release-run&lt;/a&gt; &lt;a href="https://www.nginx.com/blog/microservices-reference-architecture-nginx-twelve-factor-app/"&gt;https://www.nginx.com/blog/microservices-reference-architecture-nginx-twelve-factor-app/&lt;/a&gt; &lt;a href="https://blog.scottlogic.com/2017/07/17/successful-microservices-with-12factor-app.html"&gt;https://blog.scottlogic.com/2017/07/17/successful-microservices-with-12factor-app.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://www.techmonks.org/12-factor-app-and-cloud-native-microservices/"&gt;&lt;em&gt;http://www.techmonks.org&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on September 10, 2020.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>12factor</category>
      <category>12factorapp</category>
    </item>
    <item>
      <title>Performance Optimization Considerations for an Enterprise Application</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Sat, 22 Aug 2020 10:35:30 +0000</pubDate>
      <link>https://dev.to/anji4246/performance-optimization-considerations-for-an-enterprise-application-2k4b</link>
      <guid>https://dev.to/anji4246/performance-optimization-considerations-for-an-enterprise-application-2k4b</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KGUpdlJx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/723/1%2Alki1uCMqSbeh3E5l4ulvuA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KGUpdlJx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/723/1%2Alki1uCMqSbeh3E5l4ulvuA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Performance is an integral part of the Application design and plays a vital role in the success of your product/application. I would like to write a series of performance optimization techniques that help to design the best performant enterprise applications.&lt;/p&gt;

&lt;p&gt;I would like to write a series of articles on performance. primarily there will be two parts. Part-1 talks about the performance considerations at the design / development level and Part-2 talks about the performance improvisation techniques.&lt;/p&gt;

&lt;p&gt;To my understanding, performance optimization must be employed and evaluated at the below-mentioned stages/phases.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Application Design Level Considerations&lt;/li&gt;
&lt;li&gt;Application Development Level Considerations&lt;/li&gt;
&lt;li&gt;Application Testing and Deployment Considerations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Let us get started with the performance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Performance is the most important concern when designing applications. There are so many applications built around the same business domain. The clear winner would be the application that performs at the best and has excellent responsiveness and usability.&lt;/p&gt;

&lt;p&gt;Before delving into the performance optimization techniques, let us understand what is caching and why it is a must for any application.&lt;/p&gt;

&lt;p&gt;Adopting the cache into the application design helps to achieve the optimal performance of an application.&lt;/p&gt;

&lt;p&gt;Below is the cache definition from the Wikipedia&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;In computing, a cache is a hardware or software component that stores data so that future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhere.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Wikipedia&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  In simple words, “Cache is a technique where data will get preprocessed/precomputed and stored somewhere (In-memory &lt;em&gt;data store or distributed store) to provide the faster retrievals&lt;/em&gt; “
&lt;/h4&gt;

&lt;p&gt;When a user requests the data, preprocessed data will get served instead of computing and serving the data on-demand. This improves the performance of the application at a larger scale.&lt;/p&gt;

&lt;p&gt;Days are gone, where performance optimization of the application will be taken care of once done with the business implementation of the given requirement.&lt;/p&gt;

&lt;p&gt;Performance optimization techniques/guidelines must be designed and employed from the project inception phase itself. As part of ‘Done’ definition of the user story, product owners must include the expectations from the responsiveness as well.&lt;/p&gt;

&lt;p&gt;Below are a few policies recommended to be defined at the organization level and ensure these policies are considered as part of the application design/development.&lt;/p&gt;

&lt;h3&gt;
  
  
  Organization Level Policies
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Capturing the operational requirements as mandatory for the project and designing your solution around it. You should consider the data or user growth per year/month based on your application&lt;/li&gt;
&lt;li&gt;Employ the APM tools to measure/monitor performance of the applications (Adopting the observability from the inception phase of an application avoids surprises at the end) and define the SLAs&lt;/li&gt;
&lt;li&gt;Layout the performance practices/principles and manage them as a framework. The framework must be evolving based on the requirements&lt;/li&gt;
&lt;li&gt;Define the checklist for developers and testers aligned with your SLAs/ principles&lt;/li&gt;
&lt;li&gt;Define a process that considers load and stress testing as a mandatory for every project.&lt;/li&gt;
&lt;li&gt;Ensure application is evaluated with large volumes of the data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Following the defined practices leads to customer satisfaction and improves the quality of application at a greater level. Well defined strategies help you to optimize your application proactively before it impacts the customer business.&lt;/p&gt;

&lt;p&gt;The Performance optimization framework (practices/guidelines) must be defined at the organization level and update it frequently with new findings and improvements. I believe, it is a good idea to have a performance inspector team, their whole and sole responsibility is identifying the performance issues in any given application.&lt;/p&gt;

&lt;p&gt;Below are the few of the CORE Application Level Design considerations&lt;/p&gt;

&lt;h3&gt;
  
  
  Application Design level Considerations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Keep pages simple and lightweight. Home/Landing pages require special care&lt;/li&gt;
&lt;li&gt;Define the SLAs at each module/page level (This must be reviewed at updated at regular intervals)&lt;/li&gt;
&lt;li&gt;Identify the cache provider that meets your demands and design your cache framework around the chosen cache provider&lt;/li&gt;
&lt;li&gt;Define framework/mechanism to load data on-demand as mandatory&lt;/li&gt;
&lt;li&gt;Paging when dealing with large datasets&lt;/li&gt;
&lt;li&gt;Identify the API modules/endpoints that require caching&lt;/li&gt;
&lt;li&gt;Cache the data on the browser for applicable APIs using HTTP cache headers&lt;/li&gt;
&lt;li&gt;Provide Multi-Channel interface (Desktop and mobile have different needs)&lt;/li&gt;
&lt;li&gt;Adopt asynchronous calls when applicable&lt;/li&gt;
&lt;li&gt;Minimize the service calls from the presentation layer by employing aggregated APIs&lt;/li&gt;
&lt;li&gt;Ensure APM tools are enabled&lt;/li&gt;
&lt;li&gt;As client-side applications are evolving, opt for client-side performance monitoring tools as well.&lt;/li&gt;
&lt;li&gt;Evaluate SPA bundles before releasing them. Adding an external package/library must be evaluated from the size perspective as well.&lt;/li&gt;
&lt;li&gt;Load sections/widgets based on user settings/preferences only on home page&lt;/li&gt;
&lt;li&gt;Relational databases are very difficult to scale when dealing with huge concurrent requests. consider evaluating the No-SQL databases&lt;/li&gt;
&lt;li&gt;ORMs always require special care. Avoid the N+1 issue by using projection queries/ named queries.&lt;/li&gt;
&lt;li&gt;Explore the possibility of using read-only databases for ‘GET’ queries and master database for data modifications (Majority of Cloud providers support instant replication of data)&lt;/li&gt;
&lt;li&gt;Build the cache as part of application warm-up instead of waiting for the user request&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Application Development Level considerations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Design and optimize the database model using indexes and other optimizations techniques at the Database level&lt;/li&gt;
&lt;li&gt;Apply the cache at the applicable layers (API, Business and DAO layers) using strict cache eviction policies&lt;/li&gt;
&lt;li&gt;Employ HTTP cache headers for applicable endpoints/pages&lt;/li&gt;
&lt;li&gt;Use projection queries or other alternatives to avoid N+1 issue when dealing with ORMs&lt;/li&gt;
&lt;li&gt;Minify the CSS/JS using bundling techniques&lt;/li&gt;
&lt;li&gt;Use compression algorithms to compress the data when transferring over the network&lt;/li&gt;
&lt;li&gt;Load your JS or external packages on demand when possible&lt;/li&gt;
&lt;li&gt;Consider using CSS sprites&lt;/li&gt;
&lt;li&gt;Load the images when viewable in user viewport&lt;/li&gt;
&lt;li&gt;Evaluate and explore the options to reduce your image sizes (you can employ techniques like lossy compression)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Testing Considerations
&lt;/h3&gt;

&lt;p&gt;Defining and following the Automation, Load, and Stress Testing strategies help you to battle-test your application from day one itself.&lt;/p&gt;

&lt;p&gt;Below are a few techniques&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automate your API testing&lt;/li&gt;
&lt;li&gt;Measure the performance of each API to align with customer expectations or agreed on SLAs&lt;/li&gt;
&lt;li&gt;Must prioritize the load testing and stress testing along with functional testing&lt;/li&gt;
&lt;li&gt;Include strategies to validate the performance from geographical locations&lt;/li&gt;
&lt;li&gt;performance must be considered as important as functional testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Deployment/Infrastructure strategies
&lt;/h3&gt;

&lt;p&gt;This has a very important and high impact on the performance of an application. A simple network misconfiguration can cause much damage in terms of performance. An additional infra or network layer can delay your request from 10 milliseconds to 300 milliseconds.&lt;/p&gt;

&lt;p&gt;Additional tools that you deploy over your application topology can negatively impact your application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure your infra configurations are similar across all the environments (Immutable Infrastructures)&lt;/li&gt;
&lt;li&gt;Ensure your additional security/other layers are battle-tested before enabling them in the production environment (I have these surprises lot when I was working with Infra and DevOps team)&lt;/li&gt;
&lt;li&gt;Having multiple Smart Load balancers to avoid the single-point-of-failure for your application. Load balancers can be employed the UI/client Application, API later and Database level&lt;/li&gt;
&lt;li&gt;Configure all the required monitoring systems, log metrics, and other components of your application at the initial stage itself&lt;/li&gt;
&lt;li&gt;Ensure your deployment architecture is reviewed by cloud provider team&lt;/li&gt;
&lt;li&gt;DevOps team and Development team must collaboratively work towards of application instead of working on their own terms&lt;/li&gt;
&lt;li&gt;Ensure everything is automated&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;Image Credits:&lt;a href="https://i2.wp.com/chelseatroy.com/wp-content/uploads/2018/04/performance.png?w=836&amp;amp;ssl=1"&gt;https://chelseatroy.com/2018/04/09/performance-optimization-an-example-implemented-in-ruby/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading the article and hope you have enjoyed it. If you have any suggestions or comments, please free to add in the comment box.&lt;/p&gt;

&lt;p&gt;Please follow and like us:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q_NI1JEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2AkxtQYOZH-_nzgPSs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q_NI1JEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2AkxtQYOZH-_nzgPSs.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://www.techmonks.org/performance-optimization-considerations/"&gt;&lt;em&gt;http://www.techmonks.org&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on August 22, 2020.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>performanceoptimizat</category>
      <category>applicationdevelopme</category>
      <category>applicationdesign</category>
    </item>
    <item>
      <title>Performance Optimization Techniques</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Sat, 25 Jul 2020 11:36:45 +0000</pubDate>
      <link>https://dev.to/anji4246/performance-optimization-techniques-2ki6</link>
      <guid>https://dev.to/anji4246/performance-optimization-techniques-2ki6</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hXR-OdNd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2APXUwO8alerhPAg4f-6g3Tw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hXR-OdNd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2APXUwO8alerhPAg4f-6g3Tw.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Performance is an integral part of the Application design and plays a vital role in the success of your product/application. This is Part-2 of the performance optimization articles series. Performance optimization considerations for an enterprise-level application is discussed as part of &lt;a href="https://medium.com/@anjireddy.kata/performance-optimization-considerations-for-an-enterprise-application-2973bd9cc15b"&gt;Part-1&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Before delving into performance optimization techniques, let us discuss the factors that impact the performance of an application. below are the most critical factors that impact the performance from my view.&lt;/p&gt;

&lt;h3&gt;
  
  
  Factors that impact the performance of the application
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Stuffing home/start page with lots of functionality&lt;/li&gt;
&lt;li&gt;Making a huge number of API calls/ Loading large JS bundles as part of the initial load of the applications&lt;/li&gt;
&lt;li&gt;Ineffective JavaScript modules loading strategies (Not effectively using lazy loading)&lt;/li&gt;
&lt;li&gt;Using large size images without any image optimization/compression&lt;/li&gt;
&lt;li&gt;Preloading all the data in the browser instead of considering user preferences/user actions&lt;/li&gt;
&lt;li&gt;Not adopting CDN to deliver the content to the global audience (at least static content/files)&lt;/li&gt;
&lt;li&gt;Invalid network/tool configurations&lt;/li&gt;
&lt;li&gt;Using the same website/ APIs for Mobile and Desktop&lt;/li&gt;
&lt;li&gt;Introducing additional tools only in production envronment&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Performance Optimization techniques
&lt;/h3&gt;

&lt;p&gt;This section gives you an overview of the various techniques that can be employed at various levels of your application. At a global level, below are few areas&lt;/p&gt;

&lt;h3&gt;
  
  
  User Interface
&lt;/h3&gt;

&lt;p&gt;Below are the few of core best practices to consider as part of the user interface design and development&lt;/p&gt;

&lt;h4&gt;
  
  
  User Interface design best practices
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Consider server-side rendering for your home/landing page if it stuffed with too much functionality&lt;/li&gt;
&lt;li&gt;Load data on demand always&lt;/li&gt;
&lt;li&gt;Enabling paging when dealing with large datasets&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  JavaScript best practices
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Always keep your JS files bottom of your page&lt;/li&gt;
&lt;li&gt;Use bundling and minification tools as part of your build process&lt;/li&gt;
&lt;li&gt;Avoid using inefficient looping logic on client-side&lt;/li&gt;
&lt;li&gt;Using &lt;em&gt;async&lt;/em&gt; and &lt;em&gt;defer&lt;/em&gt; while loading the JS files into the browse&lt;/li&gt;
&lt;li&gt;use preload and prefetch&lt;/li&gt;
&lt;li&gt;use DNS-Prefetch&lt;/li&gt;
&lt;li&gt;Ensure you have enabled caching on your JS files (Every application comes with hashing the JS files.Ensure you are enabling them)&lt;/li&gt;
&lt;li&gt;Remove unused packages or be attentive towards the size of the installed package&lt;/li&gt;
&lt;li&gt;Use CDN to cache your static files like JavaScript, CSS, and images&lt;/li&gt;
&lt;li&gt;Use compression tools to optimize the file sizes over the network&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  CSS best practices
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Use preloading of CSS&lt;/li&gt;
&lt;li&gt;Use CSS sprites&lt;/li&gt;
&lt;li&gt;Avoid @import to include external stylesheets&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Images best practices
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;define images based on the device&lt;/li&gt;
&lt;li&gt;Avoid using large size images as part of the application (define max size and apply across the app)&lt;/li&gt;
&lt;li&gt;Optimize your images without losing the quality (At Least a stage human eye can’t catch the difference). lossy compressions can help determine the optimal size.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  API/Services
&lt;/h3&gt;

&lt;p&gt;Caching can drastically improve the performance of the application if configured optimally. By employing caching, you can reduce the GET queries on the databases and reduce the network calls.&lt;/p&gt;

&lt;p&gt;Object caching is used to store the processed data into a cache-store. The cached data will get served for the incoming requests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Providers: Memcached, Redis cache, Ignite, EhCache, etc. These cache providers are available as part of the cloud provider as well.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Below diagram depicts the high-level flow involved in Object caching&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SPF-gvkZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/941/0%2AsUDcN6qEVv_qVE3y" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SPF-gvkZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/941/0%2AsUDcN6qEVv_qVE3y" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By using Http cache headers we can cache the data in the browser. When the HTTP cache is enabled for a specific endpoint for 30 minutes, the browser will not make the request to the endpoint by storing the data in the cache itself.&lt;/p&gt;

&lt;p&gt;By defining the below-mentioned HTTP directives, you can enable the HTTP caching.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cache Control:&lt;/strong&gt; contains one or more comma-separated directives. These directives determine whether a response is cacheable and if so, by whom, and for how long e.g. max-age or s-max-age directives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expires:&lt;/strong&gt; specifies an absolute expiry time for a cached representation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ETag:&lt;/strong&gt; an opaque string token that a server associates with a resource to uniquely identify the state of the resource over its lifetime. When the resource changes, the ETag changes accordingly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Last-Modified:&lt;/strong&gt; indicates when the response was generated, the Last-Modified header indicates when the associated resource last changed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ORM has become an integral part of application development. ORMs allow you to encapsulate all your logic in your business layer instead of burying in a database.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid N+1 problem by adopting projection queries&lt;/li&gt;
&lt;li&gt;Load child tables only when required (consider lazy loading while writing the queries)&lt;/li&gt;
&lt;li&gt;Avoid writing complex queries using ORM framework ( I personally choose named queries or native queries to avoid performance bottlenecks of ORM queries)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  API CDN Providers
&lt;/h4&gt;

&lt;p&gt;You can use the CDNs to provide optimal performance for your APIs across various geographical regions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Providers:&lt;/strong&gt; Fastly ( &lt;a href="https://docs.fastly.com/en/guides/enabling-api-caching"&gt;https://docs.fastly.com/en/guides/enabling-api-caching&lt;/a&gt;), Amazon Cloudfront, Key CDN, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Database
&lt;/h3&gt;

&lt;p&gt;Relational databases are difficult to scale when compared to NO-SQL. Consider exploring NO-SQL databases when evaluating databases for your application.&lt;/p&gt;

&lt;p&gt;Below are the few of the techniques helpful while tuning the relational database&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created Optimized indexes&lt;/li&gt;
&lt;li&gt;Determine the expected growth and design your database&lt;/li&gt;
&lt;li&gt;Select fields instead of using ‘SELECT *’&lt;/li&gt;
&lt;li&gt;Foreign keys can impact performance negatively. Please move your foreign key validation to the business layer if possible&lt;/li&gt;
&lt;li&gt;Explore possibilities to use&lt;/li&gt;
&lt;li&gt;Run your scheduled jobs in non-business hours&lt;/li&gt;
&lt;li&gt;Explore on the possibility of using read-only databases for &lt;em&gt;GET&lt;/em&gt; queries and master database for &lt;em&gt;data modifications&lt;/em&gt; (Majority of Cloud providers support instant replication of data)&lt;/li&gt;
&lt;li&gt;Indexes can negatively impact data modification operations. Ensure indexes are disabled when loading the huge amounts of data&lt;/li&gt;
&lt;li&gt;Avoid distinct clause if possible&lt;/li&gt;
&lt;li&gt;Always select limited data&lt;/li&gt;
&lt;li&gt;One schema may not be suitable for all the requirements. If you have a reporting system, consider having a reporting database&lt;/li&gt;
&lt;li&gt;Configure notifications when a query is executing on the server beyond defined threshold times.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Network
&lt;/h3&gt;

&lt;p&gt;Network configuration is one other key area where the performance of an application depends on. We have mentioned a few of the practices as part of the Network considerations. These are just starting points and can be extended further.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DevOps / DevSecOps team should work collaboratively work with development team instead of working in their own terms&lt;/li&gt;
&lt;li&gt;Configure network monitoring tools to identify when there is a sudden surge of requests&lt;/li&gt;
&lt;li&gt;Enable notifications for your network failures and warnings&lt;/li&gt;
&lt;li&gt;Ensure Autoscaling groups are configured and battle-tested before enabling them in production&lt;/li&gt;
&lt;li&gt;Configure HTTP2 protocol for faster retrievals&lt;/li&gt;
&lt;li&gt;Ensure your applications are tested from various geographical regions&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Tools to monitor your UI performance
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://developers.google.com/web/tools/lighthouse"&gt;Chrome dev Tools (Lighthouse)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developers.google.com/speed/pagespeed/insights/"&gt;Google Page Insights&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please follow and like us:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F7e8-p0u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2Akv7k1D-r5xzmXewd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F7e8-p0u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2Akv7k1D-r5xzmXewd.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://www.techmonks.org/performance-optimization-techniques/"&gt;&lt;em&gt;http://www.techmonks.org&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on July 25, 2020.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>performance</category>
      <category>applicationdevelopme</category>
      <category>applicationdesign</category>
      <category>performanceoptimizat</category>
    </item>
    <item>
      <title>OAuth 2.0 Grant flows and Recommendations</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Fri, 17 Jul 2020 23:41:46 +0000</pubDate>
      <link>https://dev.to/anji4246/oauth-2-0-grant-flows-and-recommendations-g6f</link>
      <guid>https://dev.to/anji4246/oauth-2-0-grant-flows-and-recommendations-g6f</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zmuR3TuB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AyQsB7zxFAg4vd6H5skgKxA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zmuR3TuB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AyQsB7zxFAg4vd6H5skgKxA.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article, we would like to provide an overview of what is OAuth 2.0 and the concepts like scopes, Grant Types we must aware of before proceeding with OAuth 2.0.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is OAuth 2.0?
&lt;/h3&gt;

&lt;p&gt;OAuth 2.0 is an authorization framework that allows users to grant a third-party website or application to access the user’s protected resources without revealing their credentials or identity. For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner.&lt;/p&gt;

&lt;h3&gt;
  
  
  OAuth Scopes
&lt;/h3&gt;

&lt;p&gt;OAuth 2.0 scopes provide a way to limit the amount of access that is granted to an access token. When the app requests permission to access a resource through the Authorization server, it uses a scope parameter to specify what access it needs, and the authorization server uses the &lt;em&gt;scope&lt;/em&gt; parameter to respond with the access that was actually granted.&lt;/p&gt;

&lt;h3&gt;
  
  
  OAuth 2.0 Terminology
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Resource Owner&lt;/strong&gt; : the entity that can grant access to a protected resource. Typically this is the end-user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource Server (API Server):&lt;/strong&gt; The server that is hosting the protected resources, capable of accepting and responding to protected resource requests using access tokens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client&lt;/strong&gt; : An application making protected resource requests on behalf of the resource owner and with its authorization. The term client does not imply any particular implementation characteristics (e.g. whether the application executes on a server, a desktop, or other devices).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorization Server&lt;/strong&gt; : The server issuing access tokens to the client after successfully authenticating the resource owner and obtaining authorization.&lt;/p&gt;

&lt;h3&gt;
  
  
  OAuth Grant Types
&lt;/h3&gt;

&lt;p&gt;OAuth 2.0 provides below-mentioned grant types (“methods”) for a client application to acquire an access token that can be used to authenticate a request to API endpoints / other integrations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authorization code grant flow with PKCE ( &lt;strong&gt;P&lt;/strong&gt; roof &lt;strong&gt;K&lt;/strong&gt; ey for &lt;strong&gt;C&lt;/strong&gt; ode &lt;strong&gt;E&lt;/strong&gt; xchange)&lt;/li&gt;
&lt;li&gt;Authorization code grant flow&lt;/li&gt;
&lt;li&gt;Client credentials grant flow&lt;/li&gt;
&lt;li&gt;Implicit grant flow&lt;/li&gt;
&lt;li&gt;Resource owner credentials grant flow&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Authorization code grant flow with PKCE (Proof Key for Code Exchange)
&lt;/h3&gt;

&lt;p&gt;Please do note that the &lt;em&gt;Authorization code grant flow&lt;/em&gt; is considered insecure without PKCE.&lt;/p&gt;

&lt;p&gt;Before the introduction of PKCE, Authorization code grant flow is not recommended to use along with SPAs implemented using JavaScript frameworks. Traditionally the Authorization Code flow uses a &lt;em&gt;client secret&lt;/em&gt; when exchanging the authorization code for an access token, but there is no way to include a client secret in a JavaScript app and have it remain a secret.&lt;/p&gt;

&lt;p&gt;The above-mentioned issue is applicable to mobile native apps as well. In mobile apps, by decompiling the app, you can view the client secret. Thankfully OAuth team has solved the issue by extending the Authorization Code flow with PKCE extension.&lt;/p&gt;

&lt;p&gt;The Authorization Code flow with PKCE adds an additional step which allows us to protect the authorization code so that even if it is stolen during the redirect it will be useless by itself.&lt;/p&gt;

&lt;p&gt;The key difference between the PKCE flow and the standard Authorization Code flow is users aren’t required to provide a &lt;strong&gt;client_secret&lt;/strong&gt;. PKCE reduces security risks for native apps, and SPAs as embedded secrets aren’t required in source code, which limits exposure to reverse engineering. Client_secret is used by the Authorization server to identify the client who is making the request.&lt;/p&gt;

&lt;p&gt;In this approach, the client first generates a runtime secret called the code_verifier. The client hashes this secret and sends this value as &lt;em&gt;code_challenge&lt;/em&gt; as part of the frontend request. The Authorization server saves this value. The client includes the code_verifier as part of the subsequent code exchange request. The Authorization server compares the hash of the code_verifier with the original code_challenge it received.&lt;/p&gt;

&lt;h4&gt;
  
  
  How does It work?
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VPDzyd5y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AxguWv19QT6is1JQU.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VPDzyd5y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AxguWv19QT6is1JQU.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Authorization Code flow with PKCE is recommended for Mobile Apps, SPAs. If your application can secure the &lt;em&gt;‘Client_secret’&lt;/em&gt;, you can opt-in for &lt;strong&gt;&lt;em&gt;Authorization code Flow&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Authorization code grant flow
&lt;/h3&gt;

&lt;p&gt;Authorization code grant flow is used in web apps are server-side apps where the source code is not publicly exposed. Your application must be server-side because, during this exchange, you must also pass along your application’s Client Secret, which must always be kept secure, and you will have to store it in your client.&lt;/p&gt;

&lt;h4&gt;
  
  
  How does It work?
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mPzp5nAJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AJXpZhd2qL4PlKdH1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mPzp5nAJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AJXpZhd2qL4PlKdH1.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Authorization code grant flow is recommended to use with the web apps that are server-side apps where the source code is not publicly exposed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Client credentials grant flow
&lt;/h3&gt;

&lt;p&gt;Client credentials grant flow allows a web service to use its own credentials, instead of impersonating a user, to authenticate when calling another web service. In the approach, the client (Daemon service, Cron job) sends the credentials to the Authorization server, on successful authorization; the authorization server sends back the access token to access the resources.&lt;/p&gt;

&lt;h4&gt;
  
  
  How does It work?
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cFrv16U0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A8_uU16lDh7Dm-qj7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cFrv16U0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A8_uU16lDh7Dm-qj7.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Client credentials grant flow is recommended to use to run the scheduled jobs or authenticating the external systems requests / Remote API calls.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implicit grant flow
&lt;/h3&gt;

&lt;p&gt;The Implicit grant type is used to requests the access tokens directly from the authorization server, without the use of the authorization code or client_secret. It is recommended to use as part of JavaScript applications like Angular or React JS applications. This grant type does not include client authentication because the &lt;em&gt;client_secret&lt;/em&gt; cannot be stored safely on the public client. This grant type relies on the callback URL given when the client was registered, to validate the identity of the client.&lt;/p&gt;

&lt;h4&gt;
  
  
  How does It work?
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2PCzpDJZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ADajPlvPvrATV_B2M.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2PCzpDJZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ADajPlvPvrATV_B2M.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before the Introduction of Authorization code flow with PKCE, Implicit grant flow is recommended for SPA and Mobile applications where client secrets cannot be kept secret.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resource Owner Credentials Grant flow
&lt;/h3&gt;

&lt;p&gt;The Resource Owner Password Credentials flow allows exchanging the username and password of a user for an access token. In the grant flow, the client application accepts the user credentials (User Id and Password) in an interactive form (Login page) and sends over to the authorization server for validation. The authorization server validates the credentials and responds back with an access token.&lt;/p&gt;

&lt;p&gt;The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application.&lt;/p&gt;

&lt;p&gt;It is recommended only for first-party “official” applications released by the API provider.&lt;/p&gt;

&lt;h4&gt;
  
  
  How does It work?
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vlFgc1Ds--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A852-4V8b1xCL1tgI.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vlFgc1Ds--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A852-4V8b1xCL1tgI.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is not recommended to use with the client as it imposes additional security issues as the user entering the user id and password on an external login page. This is only recommended for the products from the Authorization Server.&lt;/p&gt;

&lt;p&gt;Thank you for reading the article. Please share your thoughts in the comments box. If you like our article, please share it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://auth0.com/docs/flows"&gt;https://auth0.com/docs/flows&lt;/a&gt; &lt;a href="https://docs.wso2.com/display/IS530/Working+with+OAuth"&gt;https://docs.wso2.com/display/IS530/Working+with+OAuth&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z8PPCR9h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2AhHyr1Yz0qUD66w9G.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z8PPCR9h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2AhHyr1Yz0qUD66w9G.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://www.techmonks.org/understanding-oauth-2-0-framework/"&gt;&lt;em&gt;http://www.techmonks.org&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on July 17, 2020.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>oauth2</category>
      <category>oidc</category>
    </item>
    <item>
      <title>Difference between 401 (Unauthorized) and 403(Forbidden) status codes</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Wed, 15 Jul 2020 06:34:20 +0000</pubDate>
      <link>https://dev.to/anji4246/difference-between-401-unauthorized-and-403-forbidden-status-codes-50n8</link>
      <guid>https://dev.to/anji4246/difference-between-401-unauthorized-and-403-forbidden-status-codes-50n8</guid>
      <description>&lt;h3&gt;
  
  
  Difference between 401 (Unauthorized) and 403(Forbidden) status codes
&lt;/h3&gt;

&lt;p&gt;When building a REST API there is always confusion when do we need to respond with &lt;em&gt;unauthorized&lt;/em&gt; (401) and when do we need to respond with &lt;em&gt;Forbidden&lt;/em&gt; (403). If the integration team doesn’t aware of the status codes, it would cause ambiguity when dealing with the REST APIs.&lt;/p&gt;

&lt;h4&gt;
  
  
  UnAuthorized (401) status code
&lt;/h4&gt;

&lt;p&gt;This is recommended to use when the token is invalid or the API couldn’t able to identify/authenticate the user request. When REST API responded with a 401 status code, we need to verify whether the token is valid or expired.&lt;/p&gt;

&lt;h4&gt;
  
  
  Forbidden (403) status code
&lt;/h4&gt;

&lt;p&gt;This is recommended to use when the token is valid but the user request doesn’t have the privilege to access the requested resource/endpoint.&lt;/p&gt;

&lt;p&gt;Please follow and like us:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OnX7NrjA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2A-kVxTPPCSyfldmzZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OnX7NrjA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2A-kVxTPPCSyfldmzZ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://www.techmonks.org/difference-between-401-unauthorized-and-403forbidden-status-codes/"&gt;&lt;em&gt;http://www.techmonks.org&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on July 15, 2020.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>401vs403</category>
      <category>restapi</category>
      <category>unauthorizedvsforbid</category>
    </item>
    <item>
      <title>Security Best Practices for REST APIs</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Sat, 11 Jul 2020 03:56:26 +0000</pubDate>
      <link>https://dev.to/anji4246/security-best-practices-for-rest-apis-3pb4</link>
      <guid>https://dev.to/anji4246/security-best-practices-for-rest-apis-3pb4</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--70c7JTHj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ATsv69KYYOakIsYl0LNQH6w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--70c7JTHj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ATsv69KYYOakIsYl0LNQH6w.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the modern era, REST APIs become an integral part of the applications. By adopting the REST APIs, you can expose your services to web applications or mobile applications and all other digital platforms.&lt;/p&gt;

&lt;p&gt;REST APIs must be built as a stateless service. REST API best practices deserve a separate article :). This article primarily focuses only on Security best practices for REST APIs.&lt;/p&gt;

&lt;p&gt;below are the key concepts that should be considered while designing the REST APIS&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication / Authorization&lt;/li&gt;
&lt;li&gt;Input Validations and Sanitization&lt;/li&gt;
&lt;li&gt;Defining Content-Types&lt;/li&gt;
&lt;li&gt;Output encoding&lt;/li&gt;
&lt;li&gt;Rate limiters&lt;/li&gt;
&lt;li&gt;Security for Data in Transit and Storage&lt;/li&gt;
&lt;li&gt;Responding with Appropriate Status codes to avoid the ambiguity&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Authentication and Authorization
&lt;/h3&gt;

&lt;p&gt;Before delving into details let us first understand what is Authentication and Authorization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication:&lt;/strong&gt; Authentication is the process of identifying whether the credentials passed along with the request are valid or not. here credentials can be passed as user id and password or a token assigned for the user session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorization&lt;/strong&gt; : Authorization is the process of identifying whether the received request is allowed to access the requested endpoint or method.&lt;/p&gt;

&lt;p&gt;In the request processing pipeline, Authentication comes first and Authorization comes next. i.e. Authorization occurs only after successful authentication of the request.&lt;/p&gt;

&lt;p&gt;Below are the most widely used Authentication types when dealing with Remote APIs (REST APIs / Web Services).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic Auth&lt;/li&gt;
&lt;li&gt;Bearer Token&lt;/li&gt;
&lt;li&gt;API Token&lt;/li&gt;
&lt;li&gt;OAuth2.0&lt;/li&gt;
&lt;li&gt;OIDC&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Basic Auth
&lt;/h3&gt;

&lt;p&gt;Basic Auth is the simplest way of dealing with Authentication when compared to other methodologies.&lt;/p&gt;

&lt;p&gt;In the Basic Auth, the user has to send the user id and password in the format of &lt;strong&gt;&lt;em&gt;userid:password&lt;/em&gt;&lt;/strong&gt; encoded in base64 format. This method is preferred only over the https protocol only. This is highly discouraged to use over HTTP as your credentials are transferring in plain format.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Authorization: Basic base64(userid:password)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Bearer Token
&lt;/h3&gt;

&lt;p&gt;Bearer Token Authentication is also known as &lt;strong&gt;Token-based&lt;/strong&gt; Authentication. When the user logs into an application using the credentials, the Authorization server generates a cryptographic token to uniquely identifies the user. the applications can use the token to identify the user after a successful login. i.e. The application is required to send this token when accessing protected resources.&lt;/p&gt;

&lt;p&gt;Similar to Basic Authentication, Bearer tokens are only recommended to send over HTTPS only.&lt;/p&gt;

&lt;p&gt;Authorization Bearer &lt;/p&gt;

&lt;h3&gt;
  
  
  API Token
&lt;/h3&gt;

&lt;p&gt;API Tokens are widely used in the web services / REST APIs security before the evaluation of Client-side frameworks. Still, many organizations use the API Tokens as a security measure for the APIs. This is the simplest way of implementing the security in REST APIs.&lt;/p&gt;

&lt;p&gt;This is recommended when providing the communication between server to server requests. It is recommended to use the IP Address registration as well when using the API keys. i.e. API Token is uniquely identified along with the IP Address. This is not recommended to use as a methodology for end-user authentication and Authorization.&lt;/p&gt;

&lt;p&gt;The API Key key can be sent as part of the &lt;em&gt;query string&lt;/em&gt; or &lt;em&gt;Authorization token&lt;/em&gt; or &lt;em&gt;custom header&lt;/em&gt; or as part of the &lt;em&gt;data&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  OAuth2.0
&lt;/h3&gt;

&lt;p&gt;OAuth2.0 is an authorization framework that allows users to grant a third-party website or application to access the user’s protected resources without revealing their credentials or identity. For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner.&lt;/p&gt;

&lt;p&gt;You probably see this option in the form of ‘Login using Google’, ‘Login using Facebook’, ‘Login using Github’ etc.&lt;/p&gt;

&lt;p&gt;By default, OAuth generates the access tokens in the format of JWT (JSON web tokens). JWTs contain three parts: a header, a payload, and a signature.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Header:&lt;/strong&gt; metadata about the token like cryptographic algorithms used to generate the token.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payload&lt;/strong&gt; : payload contains the Subject (usually identifier of the user), claims (also known as permissions or grants), and other information like audience and expiration time, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Signature:&lt;/strong&gt; used to validate the token is trustworthy and has not been tampered with.&lt;/p&gt;

&lt;p&gt;Below are the OAuth roles you must aware of when dealing OAuth2.0&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource Owner&lt;/strong&gt; : the entity that can grant access to a protected resource. Typically this is the end-user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource Server:&lt;/strong&gt; The server that is hosting the protected resources&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client&lt;/strong&gt; : the app requesting access to a protected resource on behalf of the Resource Owner.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorization Server&lt;/strong&gt; : the server that authenticates the Resource Owner, and issues Access Tokens after getting proper authorization.&lt;/p&gt;

&lt;p&gt;OAuth2.0 provides various flows or grant types suitable for different types of API clients. Grant Types are out of scope for this article.&lt;/p&gt;

&lt;p&gt;OIDC is a simple identity layer built on top of the OAuth2.0. OIDC defines a sign-in flow that enables a client application to authenticate a user, and to obtain information (or “claims”) about that user, such as the user name, email, and so on. User identity information is encoded in a secure JSON Web Token (JWT), called ID token.&lt;/p&gt;

&lt;p&gt;In the Open ID Connect, Request flow will happen as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w-gmbQz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2Aoj5b7rd3ExY2EMul.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w-gmbQz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2Aoj5b7rd3ExY2EMul.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;user will be navigated to the Authorization server from the &lt;em&gt;client app&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;The user&lt;/em&gt; enters the credentials to identify the user&lt;/li&gt;
&lt;li&gt;Upon successful authentication, Server sends back the user to client along with &lt;em&gt;authorization code&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Client app requests the Authorization server for tokens (Access Token and Id Token) using the authorization code (we can use nonce here to incorporated additional security)&lt;/li&gt;
&lt;li&gt;Authorization server responds back with tokens.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Input Validation
&lt;/h3&gt;

&lt;p&gt;Input validation should be applied to both &lt;strong&gt;syntactical&lt;/strong&gt; and &lt;strong&gt;semantic&lt;/strong&gt;  levels.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntactical:&lt;/strong&gt; should enforce correct syntax of structured fields (e.g. SSN, date, currency symbol).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Semantic:&lt;/strong&gt; should enforce correctness of their &lt;em&gt;values&lt;/em&gt; in the specific business context (e.g. start date is before the end date, price is within expected range).&lt;/p&gt;

&lt;p&gt;Basic Input validation guidelines&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define an implicit input validation by using strong types like numbers, booleans, dates, times, or fixed data ranges in API parameters.&lt;/li&gt;
&lt;li&gt;Constrain string inputs with regular expressions.&lt;/li&gt;
&lt;li&gt;Use whitelisting and blacklisting techniques&lt;/li&gt;
&lt;li&gt;Define min and maximum lengths as a mandatory&lt;/li&gt;
&lt;li&gt;Enforce Input validations on client-side and server-side&lt;/li&gt;
&lt;li&gt;Reject unexpected/illegal content with valid error messages&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Define Content-Types
&lt;/h3&gt;

&lt;p&gt;we must define the allowed content-types explicitly. It is always good practice to define the valid content types and share them with the required shareholders. Upon receiving an unexpected or missing content-type header, API must respond with HTTP response status 406 Unacceptable or 415 Unsupported Media Type.&lt;/p&gt;

&lt;h3&gt;
  
  
  Output encoding
&lt;/h3&gt;

&lt;p&gt;Content of given resources must be interpreted correctly by the browser, the server should always send the Content-Type header with the correct Content-Type, and preferably the Content-Type header should include a charset.&lt;/p&gt;

&lt;p&gt;JSON encoders must be used when dealing with JSON Data&lt;/p&gt;

&lt;h3&gt;
  
  
  Rate Limiters
&lt;/h3&gt;

&lt;p&gt;Rate limiters allow you to secure your APIs from the DDoS attacks. When exposing your API to publicly you must define the rate limiters. If you are opt-in for any cloud provider tools, they explicitly provide the rate-limiting capabilities to the public faced resources. you must adjust the configurations accordingly to your needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Security for Data in Transit and Storage&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Ensure data is sent over HTTPS only. if any user tries to access over HTTP, you should upgrade it HTTPS and handle the request&lt;/p&gt;

&lt;p&gt;Data in storage must be protected using best security practices. All the cloud providers provide you the inbuilt security (Encryption)for your backups.&lt;/p&gt;

&lt;h3&gt;
  
  
  Responding with Appropriate Status codes to avoid the ambiguity
&lt;/h3&gt;

&lt;p&gt;Below are few common status codes used along with REST APIs&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;201 — Created&lt;/li&gt;
&lt;li&gt;200 — OK&lt;/li&gt;
&lt;li&gt;202 — Accepted and queued for processing&lt;/li&gt;
&lt;li&gt;204 — No Content&lt;/li&gt;
&lt;li&gt;304 — Not Modified&lt;/li&gt;
&lt;li&gt;400 — Bad Request&lt;/li&gt;
&lt;li&gt;401 — UnAuthorized&lt;/li&gt;
&lt;li&gt;403 — Forbidden&lt;/li&gt;
&lt;li&gt;404 — Not Found&lt;/li&gt;
&lt;li&gt;405 — Method Not Allowed&lt;/li&gt;
&lt;li&gt;406 — Not Acceptable (Used with Content Types)&lt;/li&gt;
&lt;li&gt;415 — Unsupported Media Type&lt;/li&gt;
&lt;li&gt;429 — Two Many requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please share your thoughts in the comments box to improve it further.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before you go…
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;If you found this helpful please share it on Twitter, Facebook, LinkedIn, and your favorite forums. Big thanks for reading!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;references:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://auth0.com/docs/protocols/oauth2"&gt;https://auth0.com/docs/protocols/oauth2&lt;/a&gt; &lt;a href="https://swagger.io/docs/specification/authentication/oauth2/"&gt;https://swagger.io/docs/specification/authentication/oauth2/&lt;/a&gt; &lt;a href="https://dev.to/scottw/owasp-cheat-sheet-series-88i-temp-slug-6723684"&gt;https://cheatsheetseries.owasp.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please follow and like us:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w3W24fox--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2AqYICHO0kxg3NTeRz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w3W24fox--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2AqYICHO0kxg3NTeRz.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://www.techmonks.org/security-best-practices-for-rest-apis/"&gt;&lt;em&gt;http://www.techmonks.org&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on July 11, 2020.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>apisecurity</category>
      <category>securitytoken</category>
    </item>
    <item>
      <title>Cross-Cutting concerns for an Enterprise Application</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Fri, 10 Jul 2020 09:51:19 +0000</pubDate>
      <link>https://dev.to/anji4246/cross-cutting-concerns-for-an-enterprise-application-19be</link>
      <guid>https://dev.to/anji4246/cross-cutting-concerns-for-an-enterprise-application-19be</guid>
      <description>&lt;h3&gt;
  
  
  Cross-cutting concerns for an Enterprise Application
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wC7ETBWv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/620/1%2AM1A80NOT8WXWKZzxbBf67A.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wC7ETBWv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/620/1%2AM1A80NOT8WXWKZzxbBf67A.jpeg" alt=""&gt;&lt;/a&gt;Cross-cutting concerns&lt;/p&gt;

&lt;p&gt;In this article, I would like to explain what is a Cross-cutting concern and what are cross-cutting concerns that must be considered as part of the system design. In this article, I would like to provide the core concerns that should be considered while designing the application. Please do note that additional cross-cutting concerns need to be applied based on the domain of the application.&lt;/p&gt;

&lt;p&gt;Before delving into details, let us first understand what is a ‘ &lt;strong&gt;cross-cutting concern&lt;/strong&gt; ‘ and why we must consider while building the enterprise applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Concern&lt;/strong&gt; means “it is a behavior/functionality that we would like to implement in an application/ module”.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Cross-cutting-concern?&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The cross-cutting concern is a concern that is applicable throughout the application and it affects the entire application.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Cross-Cutting concerns help you to manage the application level functionalities in a centralized location.&lt;/p&gt;

&lt;p&gt;Below are the Cross-cutting concerns those are applicable for all the enterprise applications&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;li&gt;Performance&lt;/li&gt;
&lt;li&gt;Request Tracing&lt;/li&gt;
&lt;li&gt;Exception handling and Logging&lt;/li&gt;
&lt;li&gt;Monitoring&lt;/li&gt;
&lt;li&gt;Transaction Management (Distributed)&lt;/li&gt;
&lt;li&gt;Audit Log (Does not require in every application)&lt;/li&gt;
&lt;li&gt;Communication with External Systems (Does not require in every app)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Microservice Applications requires to take care of a few more additional concerns in addition to above-mentioned ones&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Centralize Configuration Management&lt;/li&gt;
&lt;li&gt;Distributed Request Tracing&lt;/li&gt;
&lt;li&gt;Service Registration &amp;amp; Discovery&lt;/li&gt;
&lt;li&gt;Service-to-service communication&lt;/li&gt;
&lt;li&gt;Message Idempotency (When dealing with message queues)&lt;/li&gt;
&lt;li&gt;Shared data / logic / libraries&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Security
&lt;/h3&gt;

&lt;p&gt;As part of the security, below are the few concepts you should look at&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication / Authorization&lt;/li&gt;
&lt;li&gt;Data transport protocols/message handling&lt;/li&gt;
&lt;li&gt;Identity and Access Management&lt;/li&gt;
&lt;li&gt;Secure Accessibility of resources&lt;/li&gt;
&lt;li&gt;Data Security (Encryption / Hashing considerations)&lt;/li&gt;
&lt;li&gt;Security at REST and Transit&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Performance&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Below are the few areas/concepts you should look at&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server-side Cache&lt;/li&gt;
&lt;li&gt;Http cache&lt;/li&gt;
&lt;li&gt;Static resources cache / CDN&lt;/li&gt;
&lt;li&gt;Browser cache&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also, please make sure you have the cache invalidation techniques in place to avoid serving the stale data to users.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Request Tracing&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;It is always good to trace the request from where it is originated and how it responded to the user. It is very helpful when debugging the application in production.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Exception handling and Logging&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Centralized exception handling is one strategy to make sure our system is always responding in a positive note. Any unhandled exception can lead to crashing the entire application.&lt;/p&gt;

&lt;p&gt;By centralizing all the exceptions into a datastore helps to identify the common errors that development needs to improve on and stability of a new feature when released to production.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Monitoring&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The monitoring system helps you to identify the system behavior and issues that are occurring in the production. It helps you to detect the failures proactively and early to avoid system failures.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Transaction Management&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Transaction management makes sure your application is following the ACID properties. By defining and adopting the transaction management strategy you can avoid data inconsistency issues.&lt;/p&gt;

&lt;p&gt;Distributed Transaction Management is critical when dealing with Microservice systems.&lt;/p&gt;

&lt;p&gt;Please let me know if you would like to add additional concerns in addition to the above-mentioned ones.&lt;/p&gt;

&lt;p&gt;Hope you enjoyed the article. Please share your thoughts in the comments box below. Thank you for reading the article.&lt;/p&gt;




</description>
      <category>architecture</category>
    </item>
    <item>
      <title>Angular Components And Data Binding Techniques</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Sat, 02 May 2020 21:44:22 +0000</pubDate>
      <link>https://dev.to/anji4246/angular-components-and-data-binding-techniques-i72</link>
      <guid>https://dev.to/anji4246/angular-components-and-data-binding-techniques-i72</guid>
      <description>&lt;p&gt;In this article, we would like to discuss the Angular component and data binding techniques available in angular.&lt;/p&gt;

&lt;p&gt;Angular components are building blocks of Angular application. An angular component represents a custom HTML element that represents a specific section on a page. Angular components always associated with a template.&lt;/p&gt;

&lt;p&gt;To make Typescript class as a component, you need to decorate with ‘@component’ metadata decorator. Below is high-level responsibilities segregation in a component&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WK0sILl5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AKRvZFX-gT_lmOkwq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WK0sILl5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AKRvZFX-gT_lmOkwq.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;@Component decorator options&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;selector: Defines the name of the HTML element that represents this component in a page&lt;/li&gt;
&lt;li&gt;Template — Holds HTML of the component&lt;/li&gt;
&lt;li&gt;TemplateUrl: Holds the HTML template path&lt;/li&gt;
&lt;li&gt;Providers: Any additional services that a component want to access in addition to the global services&lt;/li&gt;
&lt;li&gt;Encapsulation: Controls how the styling is applied to this component&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Data Binding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Data binding is the process of connecting a UI element such as textbox or dropdown with the information that populates it. Using this data binding, the information will be passed from source to destination.&lt;/p&gt;

&lt;p&gt;In angular terminology, Data binding responsible for coordinating the communication between the component’s class and its templates and often involves the passing the data&lt;/p&gt;

&lt;p&gt;There are 4 types of data binding&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Property Binding&lt;/li&gt;
&lt;li&gt;Interpolation&lt;/li&gt;
&lt;li&gt;Event Binding&lt;/li&gt;
&lt;li&gt;Two-way binding&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Property binding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Property Binding is a data binding technique that will help you to bind the properties of an HTML element with your component’s properties or methods. Property binding is a one-way binding.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button [disabled]="btnDisabled"&amp;gt;&amp;lt;/button&amp;gt; 
// component.ts 
@Component({ 
selector: 'app-component', 
templateUrl: 'component.html' 
}) 
export class Component { 
btnDisabled = true; 
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZbbQTgzW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A90_Lk8xyg8iOqUq6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZbbQTgzW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2A90_Lk8xyg8iOqUq6.png" alt=""&gt;&lt;/a&gt;Property Binding&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interpolation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Interpolation is a one-way data-binding technique that allows you to bind the component’s class properties to UI elements. it uses double curly braces ( &lt;strong&gt;&lt;code&gt;{{ your expression or property }}&lt;/code&gt;&lt;/strong&gt; ) to display the data from component to view.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{{greeting}}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event Binding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In any typical application, a user interacts with the application. As part of user interaction, the user needs to click the buttons or entering the details in text boxes, etc. All these actions come under events. In technical terms, we call them button events, keystrokes, change events, etc.&lt;/p&gt;

&lt;p&gt;If you want to send the information from view to component’s class you need to use the event binding. This is also a one-way binding and exactly does the opposite of property binding.&lt;/p&gt;

&lt;p&gt;To capture an event from the view, you need to wrap the event inside the parenthesis “()”&lt;/p&gt;

&lt;p&gt;Save&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two-way binding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The two-way binding combines the &lt;strong&gt;property binding&lt;/strong&gt; and &lt;strong&gt;event binding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QMZoa9BL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AdvmIBoPvRacQ85J_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QMZoa9BL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AdvmIBoPvRacQ85J_.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s all for today’s topic. Thank you for reading. Please share your thoughts in the comments box.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G_1Tke_7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2ApowLFoYX6xfJ4iiq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G_1Tke_7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2ApowLFoYX6xfJ4iiq.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://www.techmonks.org/angular-components/"&gt;&lt;em&gt;http://www.techmonks.org&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on May 2, 2020.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>angular</category>
      <category>databinding</category>
    </item>
    <item>
      <title>Angular Modules</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Wed, 25 Dec 2019 02:45:58 +0000</pubDate>
      <link>https://dev.to/anji4246/angular-modules-3l6h</link>
      <guid>https://dev.to/anji4246/angular-modules-3l6h</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C6hVmOHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AiBrTLaAOUki7lCFzvS_QUg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C6hVmOHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AiBrTLaAOUki7lCFzvS_QUg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Angular modules help us to organize the application into cohesive blocks of related functionality. Angular modules are much similar to packages in java and namespaces in c#&lt;/p&gt;

&lt;p&gt;Roles of an Angular Module&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Imports Other Angular Modules&lt;/li&gt;
&lt;li&gt;Identify components, pipes, and directives&lt;/li&gt;
&lt;li&gt;Export Its features&lt;/li&gt;
&lt;li&gt;Can be eagerly or lazily loaded&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Types of An Angular Module
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Root Module&lt;/li&gt;
&lt;li&gt;CORE Module&lt;/li&gt;
&lt;li&gt;Shared Module&lt;/li&gt;
&lt;li&gt;Feature/Widget Module&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Root Module
&lt;/h4&gt;

&lt;p&gt;Every Angular application requires at least one module. &lt;strong&gt;Root Module&lt;/strong&gt; is responsible for loading the root component and other parts of our app and any Angular-specific dependencies.&lt;/p&gt;

&lt;p&gt;By convention, the root module is called as &lt;strong&gt;&lt;em&gt;AppModule&lt;/em&gt;&lt;/strong&gt; and get created under the ‘./src/app’ folder.&lt;/p&gt;

&lt;h4&gt;
  
  
  Core Module
&lt;/h4&gt;

&lt;p&gt;Core modules should contain only the services, components and others that can be imported only once per application. Core Module must be only imported in &lt;strong&gt;AppModule&lt;/strong&gt; and must prevent from loading from other modules.&lt;/p&gt;

&lt;p&gt;This is especially important if you intend to lazy-load your feature modules. Since lazy-loaded modules are loaded on demand (when you access the route using the lazy-loaded feature), you could end up creating new instances of singleton services if you don’t put them in CoreModule.&lt;/p&gt;

&lt;h4&gt;
  
  
  Shared Module
&lt;/h4&gt;

&lt;p&gt;Shared Module contains the code that can be used across the project. Shared Modules can be imported into the feature modules on a need basis. Shared Module cannot be imported into AppModule or CORE Module strictly.&lt;/p&gt;

&lt;p&gt;These components don’t import and inject services from the core or other features in their constructors.&lt;/p&gt;

&lt;h4&gt;
  
  
  Feature Module
&lt;/h4&gt;

&lt;p&gt;A featured module consists of a cohesive set of functionality focused on a specific application need such as a user workflow, routing, or forms. The main aim for feature modules is delimiting the functionality that focuses on particular internal business inside a dedicated module, in order to achieve modularity.&lt;/p&gt;

&lt;p&gt;The featured module helps us to split the application into multiple modules which interns make the Root module thin so that the initial page loads quickly&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3pSESEhF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/924/0%2A5Gv46t-5KYIQ2EWv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3pSESEhF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/924/0%2A5Gv46t-5KYIQ2EWv.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Declarations:&lt;/strong&gt; It is for things that you use your HTML templates/views. It includes components, directives, and pipes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Providers:&lt;/strong&gt; for services&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imports:&lt;/strong&gt; for importing external modules that the current module depends on&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exports:&lt;/strong&gt; exports used to export the components, pipes, directives to use them in other modules within the application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Frequently Used Modules
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Angular Modules and scopes
&lt;/h4&gt;

&lt;p&gt;The confusion starts with &lt;strong&gt;components and services not having the same scope/visibility&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;declarations / &lt;strong&gt;components are in local scope&lt;/strong&gt; (private visibility),&lt;/li&gt;
&lt;li&gt;providers/services &lt;strong&gt;are (generally) in the global scope&lt;/strong&gt; (public visibility).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It means the &lt;strong&gt;components you declared are only usable in the current module&lt;/strong&gt;. If you need to use them outside, in other modules, you’ll have to export them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fYcaaLPg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2A_MRSgzzMpXHrEYNZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fYcaaLPg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2A_MRSgzzMpXHrEYNZ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://www.techmonks.org/angular-modules/"&gt;&lt;em&gt;http://www.techmonks.org&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on December 25, 2019.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>angular</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Angular CLI and Commands</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Thu, 19 Dec 2019 20:53:46 +0000</pubDate>
      <link>https://dev.to/anji4246/angular-cli-and-commands-3jj7</link>
      <guid>https://dev.to/anji4246/angular-cli-and-commands-3jj7</guid>
      <description>&lt;p&gt;&lt;a href="https://medium.com/techmonks/angular-cli-techmonks-9a9a09c6d412?source=rss-cb608f048a93------2"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rls9217f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AoAD163ylc9uP_ZRp.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Angular CLI stands for Angular Command Line Interface. It is a command-line tool to generate Angular applications. It will create all…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/techmonks/angular-cli-techmonks-9a9a09c6d412?source=rss-cb608f048a93------2"&gt;Continue reading on TechMonks »&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>angularcli</category>
      <category>angular</category>
    </item>
    <item>
      <title>Angular Architecture</title>
      <dc:creator>anjireddy k</dc:creator>
      <pubDate>Wed, 18 Dec 2019 22:03:56 +0000</pubDate>
      <link>https://dev.to/anji4246/angular-architecture-n24</link>
      <guid>https://dev.to/anji4246/angular-architecture-n24</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qEiRCbB2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/400/1%2AFz8H1D6f5X5x926JN0yj_A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qEiRCbB2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/400/1%2AFz8H1D6f5X5x926JN0yj_A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Angular is one of the widely used frameworks for building SPA applications. Angular made writing the client-side applications more ease by adopting the TypeScript.&lt;/p&gt;

&lt;p&gt;Below are the key components in Angular.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Modules&lt;/li&gt;
&lt;li&gt;Components&lt;/li&gt;
&lt;li&gt;Templates&lt;/li&gt;
&lt;li&gt;Metadata&lt;/li&gt;
&lt;li&gt;Data Binding&lt;/li&gt;
&lt;li&gt;Directives&lt;/li&gt;
&lt;li&gt;Services&lt;/li&gt;
&lt;li&gt;Dependency Injection&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Module
&lt;/h3&gt;

&lt;p&gt;In a general essence, the module is used to group the related classes together to achieve the functionality. The same definition is applicable for angular as well. In Angular, a module is a mechanism to group the related components, directives, pipes, services, etc together.&lt;/p&gt;

&lt;h3&gt;
  
  
  Components
&lt;/h3&gt;

&lt;p&gt;Components play a key role in Angular. Every Angular app must have at least one component.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;In Angular, a component represents a specific portion of the user interface (UI).&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Each component will contain a selector that will represent the HTML associated with the component. To make a class a component, we need to add @Component({}), decorator.&lt;/p&gt;

&lt;h3&gt;
  
  
  Templates
&lt;/h3&gt;

&lt;p&gt;The template contains the HTML that needs to be displayed on the user screen. In Angular, the template contains the HTML elements and Angular custom tags/expressions as part of the template. Before projecting the template content, angular transform expressions, and custom tags will be replaced by the associated HTML.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;In short, template is a combination of HTML tags + Angular Expressions + Custom tags defined using Angular&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Metadata
&lt;/h3&gt;

&lt;p&gt;In general, metadata termed as data about data. In Angular, metadata used to specify how a class needs to be processed by the Angular framework. A class decorator is used to define the metadata about the class. For example, any class that has @Component class decorator attached to it known as a Component.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Metadata defines how a class needs to be processed by the angular framework&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Data Binding
&lt;/h3&gt;

&lt;p&gt;Data binding concepts are used to bind the data from your component class to the template that is associated with the component. Below are the various way to bind the data to the view/template&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;String Interpolation&lt;/strong&gt;  — represented as “&lt;code&gt;{{ }}&lt;/code&gt;” also known as a mustache syntax. Angular process the expressions/variables insides the “&lt;code&gt;{{}}&lt;/code&gt;” and insert the output into HTML.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Property Binding&lt;/strong&gt;  — Allows binding the properties of an HTML element/Angular custom element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event Binding&lt;/strong&gt;  — Allow the application to respond to user actions and inputs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Directives
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Directives are used to add additional behavior to your HTML.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here additional behavior may be altering the layout page by adding/deleting the HTML elements or additional functionality to your HTML element.&lt;/p&gt;

&lt;p&gt;There are two types of Directives&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structural directives&lt;/strong&gt; can alter the layout of the page by adding/removing the HTML elements. Structural directives prefix with ‘*’&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Attribute directives&lt;/strong&gt; provide additional behavior or modify the appearance of your HTML elements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Services
&lt;/h3&gt;

&lt;p&gt;In Angular, Services are singleton objects which get instantiated only once during the application lifetime. It contains data that needs to be shared across the application.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The primary objective of service is to organize and share the Business logic, and data with different components of an angular application.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Dependency Injection
&lt;/h3&gt;

&lt;p&gt;Dependency Injection is a process of injecting the dependent objects into a class from an external framework/ class. So that the class can focus on primary responsibility assigned to it. Dependency Injector will take of handling the lifetime of injected dependencies.&lt;/p&gt;

&lt;p&gt;using dependency injection, we can externalize the injecting the dependencies to the classes and managing their lifetime.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DtG2OfeP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2ALNS11zVSxjKZ72oK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DtG2OfeP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/72/0%2ALNS11zVSxjKZ72oK.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="http://www.techmonks.org/angular-architecture/"&gt;&lt;em&gt;http://www.techmonks.org&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on December 18, 2019.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>angular7</category>
      <category>angular</category>
    </item>
  </channel>
</rss>
