Sunday, November 29, 2020

2020-11-29 Sunday - Load Balancing Concerns and Considerations

{work-in-progress post - I'll continue to elaborate on this post in the future, with additional sections and narrative text}

 In response to this recent article on DZone: Load Balancer Explained – Simplified Through Comics - I prepared this blog post.

A few additional suggested background reading articles that may be of interest for those who want to understand load balancing - and some of the related concerns/considerations - a bit deeper:

Background Reading

Misc. Forum Q&A 

Load Balancing Solution Vendors

NGINX

CloudFlare

F5

Broadcom CA Enterprise Software

Cloud Computing  Platforms

Microsoft Azure

AWS Cloud

Google Cloud

Saturday, November 21, 2020

2020-11-21 Saturday - Interesting Finds Today

 

Photo by iMattSmart on Unsplash

Today I've spent some time browsing through Stack Overflow questions - looking for interesting questions that I might take a stab at answering. 

An outcome of that effort has been the serendipity of learning about the following...

Puppeteer

"Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Puppeteer runs headless by default, but can be configured to run full (non-headless) Chrome or Chromium."

What can it do?

  • Generate screenshots and PDFs of pages.
  • Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. "SSR" (Server-Side Rendering)).
  • Automate form submission, UI testing, keyboard input, etc.
  • Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.
  • Capture a timeline trace of your site to help diagnose performance issues.
  • Test Chrome Extensions.

Here are some interesting links:

Additionally, these tutorial resources might be of interest
Nitay Neeman has some interesting Puppeteer content:

Playwright

🎭

  •  https://playwright.dev/
    • Playwright is a Node.js library to automate Chromium, Firefox and WebKit with a single API.
    • Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.

Chrome 87, 88

Toledo JavaScript Chess Game

JS1K - The JavaScript Code Golfing Competition

I perused the code of some of the past competition winners - and was inspired by the level of conciseness and creativity. Note: It appears the competition's last year was 2019.

TCP/IP Port Database Resources

The SpeedGuide.net resource is a wealth of aggregated information - and includes links to additional resources (such as information on the SANS Internet Storm Center)

Friday, November 20, 2020

2020-11-20 Friday - REST API Design Guidance (PUT, POST, or PATCH for update?)

Photo by Ryan Quintal on Unsplash


I spent some time this evening assembling a response to a Stackoverflow question:

My answer:

Reading the RFCs is highly recommended

RFC 7231 Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content

https://tools.ietf.org/html/rfc7231

In particular, pay close attention to Section 4.3 Method Definitions

https://tools.ietf.org/html/rfc7231#section-4.3

    • "The POST method requests that the target resource process the representation enclosed in the request according to the resource's own specific semantics."
    • "The PUT method requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload."

Which is to say - that you will find variation in how an update action is processed (some folks use POST, some use PATCH, many use PUT), depending on their implementation-specific resource semantics.

In your example, it appears that the PUT resource-specific semantic implementation is treating the submitted data element as a full replacement - and since you did not include the age element - it is left as null.

PATCH is indeed intended as the verb for doing a partial update, refer to:

RFC 5789 PATCH Method for HTTP

https://tools.ietf.org/html/rfc5789

    • "The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI. The set of changes is represented in a format called a "patch document" identified by a media type."
    • "The difference between the PUT and PATCH requests is reflected in the way the server processes the enclosed entity to modify the resource identified by the Request-URI. In a PUT request, the enclosed entity is considered to be a modified version of the resource stored on the origin server, and the client is requesting that the stored version be replaced. With PATCH, however, the enclosed entity contains a set of instructions describing how a resource currently residing on the origin server should be modified to produce a new version. The PATCH method affects the resource identified by the Request-URI, and it also MAY have side effects on other resources; i.e., new resources may be created, or existing ones modified, by the application of a PATCH."
    • "PATCH is neither safe nor idempotent"
    • "There is no guarantee that a resource can be modified with PATCH. Further, it is expected that different patch document formats will be appropriate for different types of resources and that no single format will be appropriate for all types of resources. Therefore, there is no single default patch document format that implementations are required to support."
    • "Clients need to choose when to use PATCH rather than PUT. For example, if the patch document size is larger than the size of the new resource data that would be used in a PUT, then it might make sense to use PUT instead of PATCH. A comparison to POST is even more difficult, because POST is used in widely varying ways and can encompass PUT and PATCH-like operations if the server chooses. If the operation does not modify the resource identified by the Request-URI in a predictable way, POST should be considered instead of PATCH or PUT."

When using PATCH for JSON type documents, see

RFC 6909 - JavaScript Object Notation (JSON) Patch

https://tools.ietf.org/html/rfc6902

    • "JSON Patch defines a JSON document structure for expressing a sequence of operations to apply to a JavaScript Object Notation (JSON) document; it is suitable for use with the HTTP PATCH method. The "application/json-patch+json" media type is used to identify such patch documents."

Additionally, you may find these resources useful

  1. https://restfulapi.net/http-methods/
  2. https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
  3. https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH
  4. https://en.wikipedia.org/wiki/Patch_verb
  5. http://jsonpatch.com/
  6. https://microservices.io/book

 

Interesting API Update Examples 

Okta

 


Sunday, November 08, 2020

2020-11-08 Sunday - Researching Azure API Gateway - Hybrid and Multi-Cloud Deployment

 
 
Hybrid, multi-cloud management platform for APIs across all environments

API Management in a Hybrid and Multi-Cloud World

Bring Azure services and management to any infrastructure
"For customers who want to simplify complex and distributed environments across on-premises, edge and multicloud, Azure Arc enables deployment of Azure services anywhere and extends Azure management to any infrastructure."
 
"The following functionality found in the managed gateways is not available in the self-hosted gateways:...", (KM: see article for details)

"When connectivity to Azure is lost, self-hosted gateway will be unable to receive configuration updates, report its status, or upload telemetry."

 
Deploy an Azure API Management self-hosted gateway to Docker
"Hosting self-hosted gateway in Docker is best suited for evaluation and development use cases. Kubernetes is recommended for production use."
 
Deploy a self-hosted gateway to Kubernetes

"The self-hosted gateway sends telemetry to Azure Monitor and Azure Application Insights according to configuration settings in the associated API Management service. When connectivity to Azure is temporarily lost, the flow of telemetry to Azure is interrupted and the data is lost for the duration of the outage. Consider setting up local monitoring to ensure the ability to observe API traffic and prevent telemetry loss during Azure connectivity outages."

Integrate API Management in an internal VNET with Application Gateway

How to use Azure API Management with virtual networks

"Azure Virtual Networks (VNETs) allow you to place any of your Azure resources in a non-internet routable network that you control access to. These networks can then be connected to your on-premises networks using various VPN technologies."


Azure Tips & Tricks #197:Getting started with Azure API Management

 

Copyright

© 2001-2021 International Technology Ventures, Inc., All Rights Reserved.