SlideShare a Scribd company logo
1 of 24
Download to read offline
Scaling Search Clusters
with Apache Solr &
Kubernetes
Amrit Sarkar
Engineer, Cloud Operations
Lucidworks Inc
3
SOLR
AUTOSCALING
LUCENE
HIGHLIGHTING
TEXT
SEARCH
CDCR
DISTRIBUTED
GROUPING &
FACETS
LEARNING
TO RANK
STREAMING
PLENTY MORE..
4
referred from: https://cloud.google.com/kubernetes-engine/kubernetes-comic/
5
Kubernetes (K8s)
System for running and coordinating containerized applications across a cluster of machines
referred from: https://cloud.google.com/kubernetes-engine/kubernetes-comic/
6
Run Solr Cloud within Kubernetes
Load Balancer / Ingress
(external IPs / custom route names)
Headless Service
for internal
communication
Service
IP is exposed
solr-0 solr-1 solr-2
…more solr pods
Service
IP is exposed
Headless Service
for internal
communication
zk-0 zk-1 zk-2
pv-0 pv-1 pv-2
pv-0 pv-1 pv-2
Stateful Set Stateful Set
HTTP Traffic
pv
persistent volume
7
Solr Cloud Clusters Within Kubernetes
Namespace A Namespace B Namespace C
Namespace D Namespace E
Single
Kubernetes
Cluster
Solr Cloud
Cluster
Solr Cloud
Cluster
Solr Cloud
Cluster
Solr Cloud
Cluster
Solr Cloud
Cluster
8
9
10
K8s Horizontal Pod Autoscaling
N1 N2 …...
User Traffic
Metrics Monitoring System
Custom Metric API
( Queries Per Sec )
External Layer
Solr Autoscaling
R1 R2 …...
Scaling Solr Clusters w/o Manual Intervention
11
Monitoring with Prometheus & Grafana
Prometheus helm chart: https://github.com/helm/charts/tree/master/stable/prometheus
apiVersion:
monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: solr
spec:
selector:
matchLabels:
app: solr
● Prometheus Operator:
Uses Custom Resource Definition (CRD), named ServiceMonitor,
to abstract configuration to target.
K8s Services
Monitor
Prometheus AlertManager
Manage
K8s Deployment
Grafana
12
Monitoring with Prometheus & Grafana
Kubernetes State Metrics
13
Monitoring with Prometheus & Grafana
Solr Metrics
14
Custom Metrics via Prometheus Adapter
Prometheus helm chart: https://github.com/helm/charts/tree/master/stable/prometheus
apiVersion: v1
kind: ConfigMap
metadata:
name: adapter-config
namespace: monitoring
data:
config.yaml: |
rules:
- seriesQuery: solr_requests
resources:
overrides:
kubernetes_namespace:
resource: namespace
kubernetes_pod_name:
resource: pod
name:
matches: "^(.*)_requests"
as: "${1}_requests"
metricsQuery: (<<.Series>>{<<.LabelMatchers>>})
● Prometheus Adapter:
Pull custom metrics from Prometheus installation.
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: custom-metrics-apiserver
name: custom-metrics-apiserver
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: custom-metrics-apiserver
template:
metadata:
labels:
app: custom-metrics-apiserver
name: custom-metrics-apiserver
……..
……..
15
Custom Metrics via Prometheus Adapter
Prometheus helm chart: https://github.com/helm/charts/tree/master/stable/prometheus
● Register custom metrics as external to K8s.
apiVersion: v1
kind: Service
metadata:
name: custom-metrics-apiserver
namespace: monitoring
spec:
ports:
- port: 443
targetPort: 6443
selector:
app: custom-metrics-apiserver
---
apiVersion: apiregistration.k8s.io/v1beta1
kind: APIService
metadata:
name: v1beta1.custom.metrics.k8s.io
spec:
service:
name: custom-metrics-apiserver
namespace: monitoring
root$ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1"
| jq .
{
"kind": "APIResourceList",
"apiVersion": "v1",
"groupVersion": "custom.metrics.k8s.io/v1beta1",
"resources": [
{
"name": "pods/queries_requests",
"singularName": "",
"namespaced": true,
"kind": "MetricValueList",
"verbs": [
"get"
]
},
{
"name": "namespaces/queries_requests,
"singularName": "",
"namespaced": false,
16
Custom Metrics via Commercial Monitoring Applications
17
K8s Horizontal Pod Autoscaling
solr-0 solr-1 solr-2
Stateful Set
Horizontal Pod Autoscaling
(HPA) on metric ‘M’
If metric ‘M’ value > X,
Add more pods
avg metric ‘M’ value < X
solr-0 solr-1 solr-2
Stateful Set
solr-3
until avg metric ‘M’ value < X
18
K8s Horizontal Pod Autoscaling
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: solr-hpa
namespace: solr
spec:
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Statefulset
name: solr-statefulset
minReplicas: 3
maxReplicas: 10
metrics:
- type: Pods
pods:
metricName: pods/query_requests
targetAverageValue: 2000
root$ kubectl describe hpa
Name: solr-hpa
Namespace: solr
Labels: <none>
Annotations: autoscaling.alpha.kubernetes.io/metrics:
[{"type":"Pods","pods":{"metricName":"pods/query_requests","targetAverageValue":"500"}}]
kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"autoscaling/v2beta1","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"nam
e":"solr-hpa","namespace":"s...
CreationTimestamp: Thu, 14 Aug 2020 11:11:05 -0800
Reference: Statefulset/solr-statefulset
Min replicas: 3
Max replicas: 10
Deployment pods: 0 current / 0 desired
Events: <none>
19
Solr Autoscaling
• Autoscaling in Solr provide balanced and stable cluster for various cluster change events.
• Achieved by satisfying a set of rules and sorting preferences
to select the target of cluster management operations.
S - A
S - B
R - 1
R - 1
R - 2
C
R - 2
Set solr-autoscaling policy and trigger
such that -
Add one replica to each shard of
collection
● if new Node is added
C - collection
S - shard
R - replica
20
Solr Autoscaling
Set solr-autoscaling policy and trigger such that -
Add one replica to each shard of collection
● if new Node is added "node_added_trigger":{
"event":"nodeAdded",
"waitFor":60,
"preferredOperation":"ADDREPLICA",
"actions":[
{
"name":"compute_plan",
"class":"solr.ComputePlanAction"},
{
"name":"execute_plan",
"class":"solr.ExecutePlanAction"}],
}
Trigger Policy
{
"cluster-policy":[
{
"node":"#ANY",
"replica":"<2",
"shard":"#EACH"}
]
}
Cluster Policy
21
Handling Special Cases
● What happens when nodes are removed due to scaling?
Is there a potential of losing data?
○ All replicas of collection gets hosted on scaled nodes.
● Do we need to scale on each collection on the entire cluster?
How to configure scaling on specific collection or set of collections with
common attribute?
● How does the Node Added Trigger behaves when a node gets restarted?
Replicas will be added to each shard of each collection where it was
previously not.
22
Lucidworks Managed Search
23
References
● Lucidworks Managed Search - https://lucidworks.com/products/managed-search/
● Docker - https://www.docker.com/
● Kubernetes - https://kubernetes.io/
● Run Solr on Kubernetes - https://lucidworks.com/post/running-solr-on-kubernetes-part-1/
● Monitoring Apache Solr Ecosystem on K8s -
https://www.youtube.com/watch?v=UI9mh4gSIsw
● Custom Metrics via Prometheus on K8s -
https://towardsdatascience.com/kubernetes-hpa-with-custom-metrics-from-prometheus-9f
fc201991e
● K8s HPA -https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
● Solr Autoscaling -
https://lucene.apache.org/solr/guide/8_5/solrcloud-autoscaling-policy-preferences.html
Thank You
@sarkaramrit2

More Related Content

What's hot

DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...DevOps_Fest
 
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and BloxNEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and BloxAmazon Web Services
 
Alex Casalboni - Configuration management and service discovery - Codemotion ...
Alex Casalboni - Configuration management and service discovery - Codemotion ...Alex Casalboni - Configuration management and service discovery - Codemotion ...
Alex Casalboni - Configuration management and service discovery - Codemotion ...Codemotion
 
ARC204 AWS Infrastructure Automation - AWS re: Invent 2012
ARC204 AWS Infrastructure Automation - AWS re: Invent 2012ARC204 AWS Infrastructure Automation - AWS re: Invent 2012
ARC204 AWS Infrastructure Automation - AWS re: Invent 2012Amazon Web Services
 
Heat and its resources
Heat and its resourcesHeat and its resources
Heat and its resourcesSangeeth Kumar
 
Heat up your stack
Heat up your stackHeat up your stack
Heat up your stackRico Lin
 
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015Chef
 
Azure Service Bus Queue Scala API
Azure Service Bus Queue Scala APIAzure Service Bus Queue Scala API
Azure Service Bus Queue Scala APIBraja Krishna Das
 
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...Landoop Ltd
 
Robust Operations of Kafka Streams
Robust Operations of Kafka StreamsRobust Operations of Kafka Streams
Robust Operations of Kafka Streamsconfluent
 
Cron in der Cloud - Die Top 10 Hitparade
Cron in der Cloud - Die Top 10 HitparadeCron in der Cloud - Die Top 10 Hitparade
Cron in der Cloud - Die Top 10 HitparadeQAware GmbH
 
AWS CloudFormation Intrinsic Functions and Mappings
AWS CloudFormation Intrinsic Functions and Mappings AWS CloudFormation Intrinsic Functions and Mappings
AWS CloudFormation Intrinsic Functions and Mappings Adam Book
 
Deploying a Kubernetes App with Amazon EKS
Deploying a Kubernetes App with Amazon EKSDeploying a Kubernetes App with Amazon EKS
Deploying a Kubernetes App with Amazon EKSLaura Frank Tacho
 
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...Amazon Web Services
 
CON420 Infrastructure as code for containers
CON420 Infrastructure as code for containersCON420 Infrastructure as code for containers
CON420 Infrastructure as code for containersNathan Peck
 
Disaster Recovery Site on AWS - Minimal Cost Maximum Efficiency (STG305) | AW...
Disaster Recovery Site on AWS - Minimal Cost Maximum Efficiency (STG305) | AW...Disaster Recovery Site on AWS - Minimal Cost Maximum Efficiency (STG305) | AW...
Disaster Recovery Site on AWS - Minimal Cost Maximum Efficiency (STG305) | AW...Amazon Web Services
 

What's hot (20)

DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
 
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and BloxNEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
 
Alex Casalboni - Configuration management and service discovery - Codemotion ...
Alex Casalboni - Configuration management and service discovery - Codemotion ...Alex Casalboni - Configuration management and service discovery - Codemotion ...
Alex Casalboni - Configuration management and service discovery - Codemotion ...
 
ARC204 AWS Infrastructure Automation - AWS re: Invent 2012
ARC204 AWS Infrastructure Automation - AWS re: Invent 2012ARC204 AWS Infrastructure Automation - AWS re: Invent 2012
ARC204 AWS Infrastructure Automation - AWS re: Invent 2012
 
Heat and its resources
Heat and its resourcesHeat and its resources
Heat and its resources
 
Heat up your stack
Heat up your stackHeat up your stack
Heat up your stack
 
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
 
Azure Service Bus Queue Scala API
Azure Service Bus Queue Scala APIAzure Service Bus Queue Scala API
Azure Service Bus Queue Scala API
 
Orchestrating the Cloud
Orchestrating the CloudOrchestrating the Cloud
Orchestrating the Cloud
 
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
 
Refactoring terraform
Refactoring terraformRefactoring terraform
Refactoring terraform
 
Robust Operations of Kafka Streams
Robust Operations of Kafka StreamsRobust Operations of Kafka Streams
Robust Operations of Kafka Streams
 
Cron in der Cloud - Die Top 10 Hitparade
Cron in der Cloud - Die Top 10 HitparadeCron in der Cloud - Die Top 10 Hitparade
Cron in der Cloud - Die Top 10 Hitparade
 
AWS CloudFormation Intrinsic Functions and Mappings
AWS CloudFormation Intrinsic Functions and Mappings AWS CloudFormation Intrinsic Functions and Mappings
AWS CloudFormation Intrinsic Functions and Mappings
 
Basics Of Servlet
Basics Of ServletBasics Of Servlet
Basics Of Servlet
 
AWS CloudFormation Masterclass
AWS CloudFormation MasterclassAWS CloudFormation Masterclass
AWS CloudFormation Masterclass
 
Deploying a Kubernetes App with Amazon EKS
Deploying a Kubernetes App with Amazon EKSDeploying a Kubernetes App with Amazon EKS
Deploying a Kubernetes App with Amazon EKS
 
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
 
CON420 Infrastructure as code for containers
CON420 Infrastructure as code for containersCON420 Infrastructure as code for containers
CON420 Infrastructure as code for containers
 
Disaster Recovery Site on AWS - Minimal Cost Maximum Efficiency (STG305) | AW...
Disaster Recovery Site on AWS - Minimal Cost Maximum Efficiency (STG305) | AW...Disaster Recovery Site on AWS - Minimal Cost Maximum Efficiency (STG305) | AW...
Disaster Recovery Site on AWS - Minimal Cost Maximum Efficiency (STG305) | AW...
 

Similar to Scaling Search Clusters with Apache Solr & Kubernetes

Introduction to Kubernetes RBAC
Introduction to Kubernetes RBACIntroduction to Kubernetes RBAC
Introduction to Kubernetes RBACKublr
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB
 
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.Opcito Technologies
 
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...Tobias Schneck
 
Openstack days sv building highly available services using kubernetes (preso)
Openstack days sv   building highly available services using kubernetes (preso)Openstack days sv   building highly available services using kubernetes (preso)
Openstack days sv building highly available services using kubernetes (preso)Allan Naim
 
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...Davide Benvegnù
 
Deploying deep learning models with Kubernetes and Kubeflow
Deploying deep learning models with Kubernetes and KubeflowDeploying deep learning models with Kubernetes and Kubeflow
Deploying deep learning models with Kubernetes and KubeflowDataPhoenix
 
Building the TribefireOperator
Building the TribefireOperatorBuilding the TribefireOperator
Building the TribefireOperatorOliver Moser
 
Kuryr-Kubernetes: The perfect match for networking cloud native workloads - I...
Kuryr-Kubernetes: The perfect match for networking cloud native workloads - I...Kuryr-Kubernetes: The perfect match for networking cloud native workloads - I...
Kuryr-Kubernetes: The perfect match for networking cloud native workloads - I...Cloud Native Day Tel Aviv
 
Container orchestration k8s azure kubernetes services
Container orchestration  k8s azure kubernetes servicesContainer orchestration  k8s azure kubernetes services
Container orchestration k8s azure kubernetes servicesRajesh Kolla
 
Appsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation SlidesAppsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation SlidesAppsecco
 
Kubernetes @ Nanit by Chen Fisher
Kubernetes @ Nanit by Chen FisherKubernetes @ Nanit by Chen Fisher
Kubernetes @ Nanit by Chen FisherDoiT International
 
Meetup 12-12-2017 - Application Isolation on Kubernetes
Meetup 12-12-2017 - Application Isolation on KubernetesMeetup 12-12-2017 - Application Isolation on Kubernetes
Meetup 12-12-2017 - Application Isolation on Kubernetesdtoledo67
 
Deploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with Senlin
Deploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with SenlinDeploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with Senlin
Deploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with SenlinQiming Teng
 
Kubernetes @ Nanit
Kubernetes @ NanitKubernetes @ Nanit
Kubernetes @ NanitChen Fisher
 
Serverless Machine Learning Model Inference on Kubernetes with KServe.pdf
Serverless Machine Learning Model Inference on Kubernetes with KServe.pdfServerless Machine Learning Model Inference on Kubernetes with KServe.pdf
Serverless Machine Learning Model Inference on Kubernetes with KServe.pdfStavros Kontopoulos
 
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-ServicesNode Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-ServicesChris Bailey
 
Deploying Kafka Streams Applications with Docker and Kubernetes
Deploying Kafka Streams Applications with Docker and KubernetesDeploying Kafka Streams Applications with Docker and Kubernetes
Deploying Kafka Streams Applications with Docker and Kubernetesconfluent
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using GoCloudOps2005
 

Similar to Scaling Search Clusters with Apache Solr & Kubernetes (20)

Introduction to Kubernetes RBAC
Introduction to Kubernetes RBACIntroduction to Kubernetes RBAC
Introduction to Kubernetes RBAC
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
 
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
 
Openstack days sv building highly available services using kubernetes (preso)
Openstack days sv   building highly available services using kubernetes (preso)Openstack days sv   building highly available services using kubernetes (preso)
Openstack days sv building highly available services using kubernetes (preso)
 
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...
 
Deploying deep learning models with Kubernetes and Kubeflow
Deploying deep learning models with Kubernetes and KubeflowDeploying deep learning models with Kubernetes and Kubeflow
Deploying deep learning models with Kubernetes and Kubeflow
 
Building the TribefireOperator
Building the TribefireOperatorBuilding the TribefireOperator
Building the TribefireOperator
 
Kuryr-Kubernetes: The perfect match for networking cloud native workloads - I...
Kuryr-Kubernetes: The perfect match for networking cloud native workloads - I...Kuryr-Kubernetes: The perfect match for networking cloud native workloads - I...
Kuryr-Kubernetes: The perfect match for networking cloud native workloads - I...
 
Container orchestration k8s azure kubernetes services
Container orchestration  k8s azure kubernetes servicesContainer orchestration  k8s azure kubernetes services
Container orchestration k8s azure kubernetes services
 
Appsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation SlidesAppsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation Slides
 
Kubernetes @ Nanit by Chen Fisher
Kubernetes @ Nanit by Chen FisherKubernetes @ Nanit by Chen Fisher
Kubernetes @ Nanit by Chen Fisher
 
Meetup 12-12-2017 - Application Isolation on Kubernetes
Meetup 12-12-2017 - Application Isolation on KubernetesMeetup 12-12-2017 - Application Isolation on Kubernetes
Meetup 12-12-2017 - Application Isolation on Kubernetes
 
Deploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with Senlin
Deploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with SenlinDeploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with Senlin
Deploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with Senlin
 
Kubernetes @ Nanit
Kubernetes @ NanitKubernetes @ Nanit
Kubernetes @ Nanit
 
Serverless Machine Learning Model Inference on Kubernetes with KServe.pdf
Serverless Machine Learning Model Inference on Kubernetes with KServe.pdfServerless Machine Learning Model Inference on Kubernetes with KServe.pdf
Serverless Machine Learning Model Inference on Kubernetes with KServe.pdf
 
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-ServicesNode Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
 
Deploying Kafka Streams Applications with Docker and Kubernetes
Deploying Kafka Streams Applications with Docker and KubernetesDeploying Kafka Streams Applications with Docker and Kubernetes
Deploying Kafka Streams Applications with Docker and Kubernetes
 
Aplicaciones distribuidas con Dapr
Aplicaciones distribuidas con DaprAplicaciones distribuidas con Dapr
Aplicaciones distribuidas con Dapr
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
 

Recently uploaded

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 

Recently uploaded (20)

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 

Scaling Search Clusters with Apache Solr & Kubernetes

  • 1. Scaling Search Clusters with Apache Solr & Kubernetes Amrit Sarkar Engineer, Cloud Operations Lucidworks Inc
  • 2.
  • 5. 5 Kubernetes (K8s) System for running and coordinating containerized applications across a cluster of machines referred from: https://cloud.google.com/kubernetes-engine/kubernetes-comic/
  • 6. 6 Run Solr Cloud within Kubernetes Load Balancer / Ingress (external IPs / custom route names) Headless Service for internal communication Service IP is exposed solr-0 solr-1 solr-2 …more solr pods Service IP is exposed Headless Service for internal communication zk-0 zk-1 zk-2 pv-0 pv-1 pv-2 pv-0 pv-1 pv-2 Stateful Set Stateful Set HTTP Traffic pv persistent volume
  • 7. 7 Solr Cloud Clusters Within Kubernetes Namespace A Namespace B Namespace C Namespace D Namespace E Single Kubernetes Cluster Solr Cloud Cluster Solr Cloud Cluster Solr Cloud Cluster Solr Cloud Cluster Solr Cloud Cluster
  • 8. 8
  • 9. 9
  • 10. 10 K8s Horizontal Pod Autoscaling N1 N2 …... User Traffic Metrics Monitoring System Custom Metric API ( Queries Per Sec ) External Layer Solr Autoscaling R1 R2 …... Scaling Solr Clusters w/o Manual Intervention
  • 11. 11 Monitoring with Prometheus & Grafana Prometheus helm chart: https://github.com/helm/charts/tree/master/stable/prometheus apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: solr spec: selector: matchLabels: app: solr ● Prometheus Operator: Uses Custom Resource Definition (CRD), named ServiceMonitor, to abstract configuration to target. K8s Services Monitor Prometheus AlertManager Manage K8s Deployment Grafana
  • 12. 12 Monitoring with Prometheus & Grafana Kubernetes State Metrics
  • 13. 13 Monitoring with Prometheus & Grafana Solr Metrics
  • 14. 14 Custom Metrics via Prometheus Adapter Prometheus helm chart: https://github.com/helm/charts/tree/master/stable/prometheus apiVersion: v1 kind: ConfigMap metadata: name: adapter-config namespace: monitoring data: config.yaml: | rules: - seriesQuery: solr_requests resources: overrides: kubernetes_namespace: resource: namespace kubernetes_pod_name: resource: pod name: matches: "^(.*)_requests" as: "${1}_requests" metricsQuery: (<<.Series>>{<<.LabelMatchers>>}) ● Prometheus Adapter: Pull custom metrics from Prometheus installation. apiVersion: apps/v1 kind: Deployment metadata: labels: app: custom-metrics-apiserver name: custom-metrics-apiserver namespace: monitoring spec: replicas: 1 selector: matchLabels: app: custom-metrics-apiserver template: metadata: labels: app: custom-metrics-apiserver name: custom-metrics-apiserver …….. ……..
  • 15. 15 Custom Metrics via Prometheus Adapter Prometheus helm chart: https://github.com/helm/charts/tree/master/stable/prometheus ● Register custom metrics as external to K8s. apiVersion: v1 kind: Service metadata: name: custom-metrics-apiserver namespace: monitoring spec: ports: - port: 443 targetPort: 6443 selector: app: custom-metrics-apiserver --- apiVersion: apiregistration.k8s.io/v1beta1 kind: APIService metadata: name: v1beta1.custom.metrics.k8s.io spec: service: name: custom-metrics-apiserver namespace: monitoring root$ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1" | jq . { "kind": "APIResourceList", "apiVersion": "v1", "groupVersion": "custom.metrics.k8s.io/v1beta1", "resources": [ { "name": "pods/queries_requests", "singularName": "", "namespaced": true, "kind": "MetricValueList", "verbs": [ "get" ] }, { "name": "namespaces/queries_requests, "singularName": "", "namespaced": false,
  • 16. 16 Custom Metrics via Commercial Monitoring Applications
  • 17. 17 K8s Horizontal Pod Autoscaling solr-0 solr-1 solr-2 Stateful Set Horizontal Pod Autoscaling (HPA) on metric ‘M’ If metric ‘M’ value > X, Add more pods avg metric ‘M’ value < X solr-0 solr-1 solr-2 Stateful Set solr-3 until avg metric ‘M’ value < X
  • 18. 18 K8s Horizontal Pod Autoscaling apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: name: solr-hpa namespace: solr spec: scaleTargetRef: apiVersion: extensions/v1beta1 kind: Statefulset name: solr-statefulset minReplicas: 3 maxReplicas: 10 metrics: - type: Pods pods: metricName: pods/query_requests targetAverageValue: 2000 root$ kubectl describe hpa Name: solr-hpa Namespace: solr Labels: <none> Annotations: autoscaling.alpha.kubernetes.io/metrics: [{"type":"Pods","pods":{"metricName":"pods/query_requests","targetAverageValue":"500"}}] kubectl.kubernetes.io/last-applied-configuration: {"apiVersion":"autoscaling/v2beta1","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"nam e":"solr-hpa","namespace":"s... CreationTimestamp: Thu, 14 Aug 2020 11:11:05 -0800 Reference: Statefulset/solr-statefulset Min replicas: 3 Max replicas: 10 Deployment pods: 0 current / 0 desired Events: <none>
  • 19. 19 Solr Autoscaling • Autoscaling in Solr provide balanced and stable cluster for various cluster change events. • Achieved by satisfying a set of rules and sorting preferences to select the target of cluster management operations. S - A S - B R - 1 R - 1 R - 2 C R - 2 Set solr-autoscaling policy and trigger such that - Add one replica to each shard of collection ● if new Node is added C - collection S - shard R - replica
  • 20. 20 Solr Autoscaling Set solr-autoscaling policy and trigger such that - Add one replica to each shard of collection ● if new Node is added "node_added_trigger":{ "event":"nodeAdded", "waitFor":60, "preferredOperation":"ADDREPLICA", "actions":[ { "name":"compute_plan", "class":"solr.ComputePlanAction"}, { "name":"execute_plan", "class":"solr.ExecutePlanAction"}], } Trigger Policy { "cluster-policy":[ { "node":"#ANY", "replica":"<2", "shard":"#EACH"} ] } Cluster Policy
  • 21. 21 Handling Special Cases ● What happens when nodes are removed due to scaling? Is there a potential of losing data? ○ All replicas of collection gets hosted on scaled nodes. ● Do we need to scale on each collection on the entire cluster? How to configure scaling on specific collection or set of collections with common attribute? ● How does the Node Added Trigger behaves when a node gets restarted? Replicas will be added to each shard of each collection where it was previously not.
  • 23. 23 References ● Lucidworks Managed Search - https://lucidworks.com/products/managed-search/ ● Docker - https://www.docker.com/ ● Kubernetes - https://kubernetes.io/ ● Run Solr on Kubernetes - https://lucidworks.com/post/running-solr-on-kubernetes-part-1/ ● Monitoring Apache Solr Ecosystem on K8s - https://www.youtube.com/watch?v=UI9mh4gSIsw ● Custom Metrics via Prometheus on K8s - https://towardsdatascience.com/kubernetes-hpa-with-custom-metrics-from-prometheus-9f fc201991e ● K8s HPA -https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ ● Solr Autoscaling - https://lucene.apache.org/solr/guide/8_5/solrcloud-autoscaling-policy-preferences.html