All Projects → CaptainCodeman → gce-cache-cluster

CaptainCodeman / gce-cache-cluster

Licence: other
Easy groupcache clustering on GCE

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to gce-cache-cluster

Escalator
Escalator is a batch or job optimized horizontal autoscaler for Kubernetes
Stars: ✭ 539 (+1584.38%)
Mutual labels:  cluster, autoscaling
Elasticluster
Create clusters of VMs on the cloud and configure them with Ansible.
Stars: ✭ 298 (+831.25%)
Mutual labels:  cluster, gcp
magento-cluster
Highly Available and Auto-scalable Magento Cluster
Stars: ✭ 21 (-34.37%)
Mutual labels:  cluster, autoscaling
skyring
Distributed timers as a service - for Node.js
Stars: ✭ 27 (-15.62%)
Mutual labels:  cluster, gossip
kubernetes-vmware-autoscaler
Kubernetes autoscaler for vsphere
Stars: ✭ 33 (+3.13%)
Mutual labels:  cluster, autoscaling
Gardener
Kubernetes-native system managing the full lifecycle of conformant Kubernetes clusters as a service on Alicloud, AWS, Azure, GCP, OpenStack, EquinixMetal, vSphere, MetalStack, and Kubevirt with minimal TCO.
Stars: ✭ 2,093 (+6440.63%)
Mutual labels:  cluster, gcp
Arvados
An open source platform for managing and analyzing biomedical big data
Stars: ✭ 274 (+756.25%)
Mutual labels:  cluster, gcp
Magento-2-aws-cluster-terraform
Magento 2 AWS autoscaling cluster with Terraform and Packer or ImageBuilder. Adobe Commerce Cloud alternative. The best ecommerce infrastructure. Drive more sales online. Transparent billing. Developer-friendly. No hidden bottlenecks.
Stars: ✭ 107 (+234.38%)
Mutual labels:  cluster, autoscaling
laniakea
Laniakea is a utility for managing instances at various cloud providers and aids in setting up a fuzzing cluster.
Stars: ✭ 28 (-12.5%)
Mutual labels:  cluster, gce
iris3
An upgraded and improved version of the Iris automatic GCP-labeling project
Stars: ✭ 38 (+18.75%)
Mutual labels:  gcp, gce
ClusterMonitor
Very simple script which logs the CPU and RAM usage of the submitted job.
Stars: ✭ 23 (-28.12%)
Mutual labels:  cluster
SimpleCSPM
GCP CSPM using Google Sheets
Stars: ✭ 24 (-25%)
Mutual labels:  gcp
serverless-ktp-ocr
Serverless Indonesian Identity E-KTP OCR with Google Cloud Platform (GCP) - Cloud Functions, Cloud Storage, and Cloud PubSub
Stars: ✭ 54 (+68.75%)
Mutual labels:  gcp
terraforming-gcp
use terraform, deploy yourself a pcf
Stars: ✭ 73 (+128.13%)
Mutual labels:  gcp
pg-dock
pg-dock cluster managment
Stars: ✭ 19 (-40.62%)
Mutual labels:  cluster
deathnode
Gracefully kill Mesos nodes in AWS for autoscaling and inmutable deployments
Stars: ✭ 17 (-46.87%)
Mutual labels:  autoscaling
terraform-splunk-log-export
Deploy Google Cloud log export to Splunk using Terraform
Stars: ✭ 26 (-18.75%)
Mutual labels:  gcp
proxmox-tools
📦 A collection of stuff that I and others wrote for Proxmox 📦
Stars: ✭ 112 (+250%)
Mutual labels:  cluster
ClusterAnalysis.jl
Cluster Algorithms from Scratch with Julia Lang. (K-Means and DBSCAN)
Stars: ✭ 22 (-31.25%)
Mutual labels:  cluster
gcp-ingestion
Documentation and implementation of telemetry ingestion on Google Cloud Platform
Stars: ✭ 60 (+87.5%)
Mutual labels:  gcp

GCE Cache Cluster

Easy groupcache clustering on GCE

Overview

Groupcache is amazing, it's like memcache on steroids but offering some new features:

  • Can run on your existing servers rather than as a separate service.
  • De-dupes cache requests to avoid "stempeding herd" cache filling.
  • Improves response time as hot items can kept in-memory (no network request).

Fun fact - Groupcache was written by the same author as memcache (so yeah, he probably knows a thing or two about caching). It's also used within Google so you can be confident it works at scale.

There is a lot to love about groupcache so, if you're using Go, it's really a no-brainer. There's just one issue ...

Peer Discovery

In order for groupcache to work, the servers need to know about each other. That is, each server needs to keep an updated list of it's peers so it knows which node is responsible for loading and caching any item.

This package is designed to make that easier if you're using Google Compute Engine (GCE) especially if you have any kind of auto-scaling. It will handle the job of maintaining the list of peers and can be configured to filter the nodes that should be considered part of any cluster (you may have more than one "service" within a project which should each have their own independent groupcache).

Usage

Import the package:

import (
    "github.com/captaincodeman/gce-cache-cluster"
)

Create a configuration or use the LoadConfig function to load from an .ini file (defaults to cachecluster.ini):

config, _ := cachecluster.LoadConfig("")

Example configuration file:

[cache]
port = 9080               # port that groupcache will run on

[cluster]
port = 9999               # port for cluster traffic
heartbeat = 250           # heartbeat in milliseconds

[match]
project = my-project      # project name (see note)
zone = us-central1-b      # zone name (see note)
network_interface = nic0  # network interface to use
tags = http-server        # tags used to match instances

[meta]
service = web             # metadata used to match instances

NOTE: The project and zone are populated automatically from the GCE metadata.

Create a new cache instance with the config:

cache, _ := cachecluster.New(config)

Start the groupcache webserver:

go http.ListenAndServe(cache.ListenOn(), cache)

Run your own web server as normal using groupcache to fill data from the cache when needed.

The groupcache peers will be kept updated automatically whenever any GCE instances are added or removed. The project, zone, tags and meta settings are used to limit which instances should be considered part of the cluster.

How it works

When a machine starts up the GCE metadata service is used to retrieve a list of running instances within the project & zone and the configuration settings used to filter these to those that should be considered part of the cluster.

A clustering package based on SWIM (Scalable Weakly-consistent Infection-style Membership) is then used to keep track of which nodes are alive. As new instances start the existing nodes are notified and dead nodes are removed.

The end result is that each node in the cluster maintains a complete list of peers that is kept uptodate very quickly.

All this is done in a separate goroutine so startup of groupcache and the web service is not delayed. The groupcache will initially be operating in 'local' mode so the app will work fine while any cluster discovery is being performed.

Networking

Most examples for groupcache seem to use port 9080 and the clustering package uses 9999 so I've continued to use those defaults. Whatever ports you use, it is important that the nodes be able to communicate with each other over them!

Exactly how you do this will depend on your setup but some things to consider are:

  • IPTable configuration
  • Docker configuration (exposed ports)
  • Networking firewall for GCP project

Example

See the example project for a working example.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].