SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Perforce Replication
              The Definitive Guide




Sven Erik Knop
Senior Consultant
SOME QUOTES


Deutsch’s Eight Fallacies of Distributed Computing:
•  The network is reliable.
•  Latency is zero.
•  Bandwidth is infinite.
•  The network is secure.
•  Topology doesn't change.
•  There is one administrator.
•  Transport cost is zero.
•  The network is homogeneous.

(Peter Deutsch)
CURRENT PROBLEMS


•  Perforce server benefits from replication
  •  High availability
  •  Disaster recovery
  •  Load sharing (for example for reports and build
     servers)

•  rsync has issues
  •  Cannot handle running Perforce server gracefully
  •  Building file list takes too long
  •  No transactional safety
  •  External dependency and processes
SOLUTION


•  Server-to-Server replication
  •  Directly supported by Perforce “out-of-the-box”
  •  Asynchronous based on journal file
  •  Supports both Metadata-only and full replication
  •  No need for external scripts, complete solution


•  Replica server is running in read-only mode
  •  Requires separate license file (free of charge)
ARCHITECTURE




                     pull                pull -u




                    db.*     state                           db.*




                                                   rdb.lbr
                   journal
 depots                              depots



          Master                      Replica
P4 PULL


 •  Run against the replica server

Command              Effect
p4 pull              Retrieve missing journal entries, then terminate
p4 pull –i <N>       Continuously pull every <N> seconds
p4 pull –u           Retrieve missing file revisions, then terminate
p4 pull –u –i <N> Continuously pull file revisions
p4 pull –l           List missing file revisions or errors

 •  Can be run as background task inside the replica
HOW DOES ‘PULL’ KEEP TRACK?


•  state file
  •  Text file normally located in the replica P4ROOT
     directory
  •  journal#/offset
  •  Allows replication to be interrupted
  •  Master server can rotate journal file
     •  Specify ‘-J prefix’ if master uses journal prefix for
        checkpoints

•  rdb.lbr database
  •  Binary file located in the replica P4ROOT directory
  •  Contains information on missing archive revisions
JOURNAL ROTATION AND PREFIX


•  Master
  •  p4 admin checkpoint/journal [-z] prefix

  •  Do not use –z (compression)!
  •  If you use a prefix, use the same prefix for ‘p4 pull’


•  Replica
  •  p4 pull –J prefix [-i <N>]

  •  Journal will rotated in sync with the master (in
     P4ROOT)
CONFIGURATION


•  ‘p4 pull’ is designed to be a background process
  •  Started from the replica server
  •  One process for retrieving metadata
  •  Several additional processes to retrieve archive data


•  Use the new ‘p4 configure set’
  •  p4 configure set monitor=3
  •  p4 configure set
     repl1#statefile=repl1_state
PREPARE IN THE MASTER


 P4NAME=Master                                    P4NAME=Repl_1


            checkpoint               restore

monitor=1                                      monitor=1
Repl_1#monitor=3                               Repl_1#monitor=3
Repl_1#P4TARGET=master:1666                    Repl_1#P4TARGET=master:1666
Repl_1#P4PORT=repl1:1666                       Repl_1#P4PORT=repl1:1666
Repl_1#P4LOG=repl1_log                         Repl_1#P4LOG=repl1_log
Repl_2#monitor=3                               Repl_2#monitor=3
Repl_2#P4TARGET=master:1666                    Repl_2#P4TARGET=master:1666
Repl_2#P4PORT=repl2:1999                       Repl_2#P4PORT=repl2:1999
Repl_2#P4LOG=repl2_log                         Repl_2#P4LOG=repl2_log




P4NAME determines which configuration is active
CONFIGURATION PARAMETERS


Parameter         Values (examples)
P4PORT            1666
P4TARGET          master:1666
db.replication    readonly
lbr.replication   readonly
serviceUser       service_replica
monitor           1
startup.1         pull –i 1[-J prefix]
startup.2         pull –u –i 1
startup.3         pull –u –i 1
SERVICEUSER


•  Special user for background processes
  •  Type: Service
•  Ignores AUTH_CHECK trigger, local password instead
•  Needs entry in the protection table, typically ‘super’
•  Does not consume a license
•  Can only run a few limited commands
    p4 login         p4 logout     p4 passwd
    p4 info          p4 user

•  Needs to be logged in before replication can start
  •  P4TICKETS
MONITORING


•  p4 monitor show –a (on replica)
  •  695 R service          72:22:23 pull -i 1
  •  696 R service          72:22:23 pull -u -i 1
  •  697 R service          72:22:23 pull -u -i 1

•  p4 logtail (on master, with server=1..3)
  •  rmt-Journal
  •  rmt-FileFetch

•  p4 pull –l
  •  Reports pending archive file transfers

•  p4 verify
CONNECT TO THE REPLICA


•  Replica is read-only
•  ‘p4 login’ requires database change for ticket

•  Solution:
  •  Replica forwards request to Master
  •  ‘p4 pull’ retrieves ticket from Master


•  ‘p4 login’ can experience delay

•  Alternative: P4AUTH pointing to master server
  •  Faster in LAN, but slower in WAN
COMMANDS ON THE REPLICA


•  Only read-only commands are allowed
  •  ‘p4 sync –p’, ‘p4 print’, but not ‘p4 sync’


•  Clients used against the replica must be created on
   the master server
  •  Will be replicated across


•  Timestamps do not get updated
USE CASES: HIGH AVAILABILITY


•  Recommended: identical hardware to master
•  Asynchronous solution:
   •  Replica can be a few seconds behind master
   •  HA server usually within the same LAN
•  Failover procedure:
   •  Stop replica
   •  Restart with P4NAME set to master name
   •  è Replica becomes the master

•  Currently no fallback to former master
   •  Need to build a new replica
   •  Do not automate failover!
USE CASES
USE CASES: DISASTER RECOVERY


•  Hardware requirements typically less than HA
  •  DR Server is not expected to handle the same load


•  DR replica can be several minutes behind master
  •  DR server needs to be physically separated from
     master
  •  RPO (recovery point objective) depends on bandwidth


•  Failover scenarios similar to HA
USE CASES: BUILD SERVER


•  Usable for full builds
  •  No incremental file update of the workspace
  •  Need to use ‘p4 sync –p’ or ‘p4 print’ to retrieve files
  •  Use long-lasting ticket or P4AUTH to avoid delay waiting for ‘p4
     login’


•  Can use P4Broker to redirect read-only commands
   to replica (http://kb.perforce.com/article/1354)

•  Alternative to P4Proxy for builds
USE CASES: REPORTING


•  Reporting does not require access to archive files

•  Reporting replica:
  •  lbr.replication=none
  •  No ‘p4 pull –u’ background tasks

•  Can also be used with P4Broker

•  Use ‘p4 replicate’ instead of ‘p4 pull’ to filter
  •  No background task, needs to be run separately
THE FUTURE


•  Backup using replica server
  •  Missing link between replica checkpoint and
     master journal

•  Federated servers
  •  Advanced proxy with some Metadata

•  Better reporting and recovery options
QUESTIONS?

Weitere ähnliche Inhalte

Was ist angesagt?

P4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC OffloadP4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC Offload
Open-NFP
 
5 Vampir Configuration At Iu
5 Vampir Configuration At Iu5 Vampir Configuration At Iu
5 Vampir Configuration At Iu
RobertHenschel
 
pgDay Asia 2016 - Swapping Pacemaker-Corosync for repmgr (1)
pgDay Asia 2016 - Swapping Pacemaker-Corosync for repmgr (1)pgDay Asia 2016 - Swapping Pacemaker-Corosync for repmgr (1)
pgDay Asia 2016 - Swapping Pacemaker-Corosync for repmgr (1)
Wei Shan Ang
 
Final_Report_new (1)
Final_Report_new (1)Final_Report_new (1)
Final_Report_new (1)
Adarsh Burma
 

Was ist angesagt? (20)

SREConEurope15 - The evolution of the DHCP infrastructure at Facebook
SREConEurope15 - The evolution of the DHCP infrastructure at FacebookSREConEurope15 - The evolution of the DHCP infrastructure at Facebook
SREConEurope15 - The evolution of the DHCP infrastructure at Facebook
 
Measuring directly from cpu hardware performance counters
Measuring directly from cpu  hardware performance countersMeasuring directly from cpu  hardware performance counters
Measuring directly from cpu hardware performance counters
 
Bypassing ASLR Exploiting CVE 2015-7545
Bypassing ASLR Exploiting CVE 2015-7545Bypassing ASLR Exploiting CVE 2015-7545
Bypassing ASLR Exploiting CVE 2015-7545
 
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixKernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at Netflix
 
Transferring Changes Between Perforce Servers
Transferring Changes Between Perforce ServersTransferring Changes Between Perforce Servers
Transferring Changes Between Perforce Servers
 
P4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC OffloadP4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC Offload
 
Performance Analysis Tools for Linux Kernel
Performance Analysis Tools for Linux KernelPerformance Analysis Tools for Linux Kernel
Performance Analysis Tools for Linux Kernel
 
5 Vampir Configuration At Iu
5 Vampir Configuration At Iu5 Vampir Configuration At Iu
5 Vampir Configuration At Iu
 
Linux Kernel Debugging
Linux Kernel DebuggingLinux Kernel Debugging
Linux Kernel Debugging
 
White Paper: Perforce Administration Optimization, Scalability, Availability ...
White Paper: Perforce Administration Optimization, Scalability, Availability ...White Paper: Perforce Administration Optimization, Scalability, Availability ...
White Paper: Perforce Administration Optimization, Scalability, Availability ...
 
pgDay Asia 2016 - Swapping Pacemaker-Corosync for repmgr (1)
pgDay Asia 2016 - Swapping Pacemaker-Corosync for repmgr (1)pgDay Asia 2016 - Swapping Pacemaker-Corosync for repmgr (1)
pgDay Asia 2016 - Swapping Pacemaker-Corosync for repmgr (1)
 
Ebpf ovsconf-2016
Ebpf ovsconf-2016Ebpf ovsconf-2016
Ebpf ovsconf-2016
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
 
Multi-Site Perforce at NetApp
Multi-Site Perforce at NetAppMulti-Site Perforce at NetApp
Multi-Site Perforce at NetApp
 
Container Performance Analysis
Container Performance AnalysisContainer Performance Analysis
Container Performance Analysis
 
A user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management toolsA user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management tools
 
Performance optimization 101 - Erlang Factory SF 2014
Performance optimization 101 - Erlang Factory SF 2014Performance optimization 101 - Erlang Factory SF 2014
Performance optimization 101 - Erlang Factory SF 2014
 
DevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructure
DevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructureDevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructure
DevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructure
 
Final_Report_new (1)
Final_Report_new (1)Final_Report_new (1)
Final_Report_new (1)
 
Cilium - Fast IPv6 Container Networking with BPF and XDP
Cilium - Fast IPv6 Container Networking with BPF and XDPCilium - Fast IPv6 Container Networking with BPF and XDP
Cilium - Fast IPv6 Container Networking with BPF and XDP
 

Ähnlich wie Replication

[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
Perforce
 
Reorder buf
Reorder bufReorder buf
Reorder buf
Aarsh Ps
 
Deep Dive In To Redis Replication: Vishy Kasar
Deep Dive In To Redis Replication: Vishy KasarDeep Dive In To Redis Replication: Vishy Kasar
Deep Dive In To Redis Replication: Vishy Kasar
Redis Labs
 

Ähnlich wie Replication (20)

LAB - Perforce Large Scale & Multi-Site Implementations
LAB - Perforce Large Scale & Multi-Site ImplementationsLAB - Perforce Large Scale & Multi-Site Implementations
LAB - Perforce Large Scale & Multi-Site Implementations
 
[India Merge World Tour] Meru Networks
[India Merge World Tour] Meru Networks[India Merge World Tour] Meru Networks
[India Merge World Tour] Meru Networks
 
[Perforce] Replication - Read Only Installs to Fully Filtered Forwarding
[Perforce] Replication - Read Only Installs to Fully Filtered Forwarding[Perforce] Replication - Read Only Installs to Fully Filtered Forwarding
[Perforce] Replication - Read Only Installs to Fully Filtered Forwarding
 
Tips for Administering Complex Distributed Perforce Environments
Tips for Administering Complex Distributed Perforce EnvironmentsTips for Administering Complex Distributed Perforce Environments
Tips for Administering Complex Distributed Perforce Environments
 
Demystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live scDemystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live sc
 
Scaling Servers and Storage for Film Assets
Scaling Servers and Storage for Film Assets  Scaling Servers and Storage for Film Assets
Scaling Servers and Storage for Film Assets
 
Where is my bottleneck? Performance troubleshooting in Flink
Where is my bottleneck? Performance troubleshooting in FlinkWhere is my bottleneck? Performance troubleshooting in Flink
Where is my bottleneck? Performance troubleshooting in Flink
 
Replication and replica sets
Replication and replica setsReplication and replica sets
Replication and replica sets
 
[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
 
Reorder buf
Reorder bufReorder buf
Reorder buf
 
Evolution Of MongoDB Replicaset
Evolution Of MongoDB ReplicasetEvolution Of MongoDB Replicaset
Evolution Of MongoDB Replicaset
 
Magento Imagine 2015 - Aspirin For Your MySQL Headaches
Magento Imagine 2015 - Aspirin For Your MySQL HeadachesMagento Imagine 2015 - Aspirin For Your MySQL Headaches
Magento Imagine 2015 - Aspirin For Your MySQL Headaches
 
Make Your Containers Faster: Linux Container Performance Tools
Make Your Containers Faster: Linux Container Performance ToolsMake Your Containers Faster: Linux Container Performance Tools
Make Your Containers Faster: Linux Container Performance Tools
 
[Altibase] 12 replication part5 (optimization and monitoring)
[Altibase] 12 replication part5 (optimization and monitoring)[Altibase] 12 replication part5 (optimization and monitoring)
[Altibase] 12 replication part5 (optimization and monitoring)
 
Deep Dive In To Redis Replication: Vishy Kasar
Deep Dive In To Redis Replication: Vishy KasarDeep Dive In To Redis Replication: Vishy Kasar
Deep Dive In To Redis Replication: Vishy Kasar
 
Replication, Durability, and Disaster Recovery
Replication, Durability, and Disaster RecoveryReplication, Durability, and Disaster Recovery
Replication, Durability, and Disaster Recovery
 
Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale
 
Supporting Android-based Platform Development in Samsung
Supporting Android-based Platform Development in SamsungSupporting Android-based Platform Development in Samsung
Supporting Android-based Platform Development in Samsung
 
Evolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best PracticesEvolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best Practices
 
Drop the Pressure on your Production Server
Drop the Pressure on your Production ServerDrop the Pressure on your Production Server
Drop the Pressure on your Production Server
 

Mehr von Perforce

Mehr von Perforce (20)

How to Organize Game Developers With Different Planning Needs
How to Organize Game Developers With Different Planning NeedsHow to Organize Game Developers With Different Planning Needs
How to Organize Game Developers With Different Planning Needs
 
Regulatory Traceability: How to Maintain Compliance, Quality, and Cost Effic...
Regulatory Traceability:  How to Maintain Compliance, Quality, and Cost Effic...Regulatory Traceability:  How to Maintain Compliance, Quality, and Cost Effic...
Regulatory Traceability: How to Maintain Compliance, Quality, and Cost Effic...
 
Efficient Security Development and Testing Using Dynamic and Static Code Anal...
Efficient Security Development and Testing Using Dynamic and Static Code Anal...Efficient Security Development and Testing Using Dynamic and Static Code Anal...
Efficient Security Development and Testing Using Dynamic and Static Code Anal...
 
Understanding Compliant Workflow Enforcement SOPs
Understanding Compliant Workflow Enforcement SOPsUnderstanding Compliant Workflow Enforcement SOPs
Understanding Compliant Workflow Enforcement SOPs
 
Branching Out: How To Automate Your Development Process
Branching Out: How To Automate Your Development ProcessBranching Out: How To Automate Your Development Process
Branching Out: How To Automate Your Development Process
 
How to Do Code Reviews at Massive Scale For DevOps
How to Do Code Reviews at Massive Scale For DevOpsHow to Do Code Reviews at Massive Scale For DevOps
How to Do Code Reviews at Massive Scale For DevOps
 
How to Spark Joy In Your Product Backlog
How to Spark Joy In Your Product Backlog How to Spark Joy In Your Product Backlog
How to Spark Joy In Your Product Backlog
 
Going Remote: Build Up Your Game Dev Team
Going Remote: Build Up Your Game Dev Team Going Remote: Build Up Your Game Dev Team
Going Remote: Build Up Your Game Dev Team
 
Shift to Remote: How to Manage Your New Workflow
Shift to Remote: How to Manage Your New WorkflowShift to Remote: How to Manage Your New Workflow
Shift to Remote: How to Manage Your New Workflow
 
Hybrid Development Methodology in a Regulated World
Hybrid Development Methodology in a Regulated WorldHybrid Development Methodology in a Regulated World
Hybrid Development Methodology in a Regulated World
 
Better, Faster, Easier: How to Make Git Really Work in the Enterprise
Better, Faster, Easier: How to Make Git Really Work in the EnterpriseBetter, Faster, Easier: How to Make Git Really Work in the Enterprise
Better, Faster, Easier: How to Make Git Really Work in the Enterprise
 
Easier Requirements Management Using Diagrams In Helix ALM
Easier Requirements Management Using Diagrams In Helix ALMEasier Requirements Management Using Diagrams In Helix ALM
Easier Requirements Management Using Diagrams In Helix ALM
 
How To Master Your Mega Backlog
How To Master Your Mega Backlog How To Master Your Mega Backlog
How To Master Your Mega Backlog
 
Achieving Software Safety, Security, and Reliability Part 3: What Does the Fu...
Achieving Software Safety, Security, and Reliability Part 3: What Does the Fu...Achieving Software Safety, Security, and Reliability Part 3: What Does the Fu...
Achieving Software Safety, Security, and Reliability Part 3: What Does the Fu...
 
How to Scale With Helix Core and Microsoft Azure
How to Scale With Helix Core and Microsoft Azure How to Scale With Helix Core and Microsoft Azure
How to Scale With Helix Core and Microsoft Azure
 
Achieving Software Safety, Security, and Reliability Part 2
Achieving Software Safety, Security, and Reliability Part 2Achieving Software Safety, Security, and Reliability Part 2
Achieving Software Safety, Security, and Reliability Part 2
 
Should You Break Up With Your Monolith?
Should You Break Up With Your Monolith?Should You Break Up With Your Monolith?
Should You Break Up With Your Monolith?
 
Achieving Software Safety, Security, and Reliability Part 1: Common Industry ...
Achieving Software Safety, Security, and Reliability Part 1: Common Industry ...Achieving Software Safety, Security, and Reliability Part 1: Common Industry ...
Achieving Software Safety, Security, and Reliability Part 1: Common Industry ...
 
What's New in Helix ALM 2019.4
What's New in Helix ALM 2019.4What's New in Helix ALM 2019.4
What's New in Helix ALM 2019.4
 
Free Yourself From the MS Office Prison
Free Yourself From the MS Office Prison Free Yourself From the MS Office Prison
Free Yourself From the MS Office Prison
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Replication

  • 1. Perforce Replication The Definitive Guide Sven Erik Knop Senior Consultant
  • 2. SOME QUOTES Deutsch’s Eight Fallacies of Distributed Computing: •  The network is reliable. •  Latency is zero. •  Bandwidth is infinite. •  The network is secure. •  Topology doesn't change. •  There is one administrator. •  Transport cost is zero. •  The network is homogeneous. (Peter Deutsch)
  • 3. CURRENT PROBLEMS •  Perforce server benefits from replication •  High availability •  Disaster recovery •  Load sharing (for example for reports and build servers) •  rsync has issues •  Cannot handle running Perforce server gracefully •  Building file list takes too long •  No transactional safety •  External dependency and processes
  • 4. SOLUTION •  Server-to-Server replication •  Directly supported by Perforce “out-of-the-box” •  Asynchronous based on journal file •  Supports both Metadata-only and full replication •  No need for external scripts, complete solution •  Replica server is running in read-only mode •  Requires separate license file (free of charge)
  • 5. ARCHITECTURE pull pull -u db.* state db.* rdb.lbr journal depots depots Master Replica
  • 6. P4 PULL •  Run against the replica server Command Effect p4 pull Retrieve missing journal entries, then terminate p4 pull –i <N> Continuously pull every <N> seconds p4 pull –u Retrieve missing file revisions, then terminate p4 pull –u –i <N> Continuously pull file revisions p4 pull –l List missing file revisions or errors •  Can be run as background task inside the replica
  • 7. HOW DOES ‘PULL’ KEEP TRACK? •  state file •  Text file normally located in the replica P4ROOT directory •  journal#/offset •  Allows replication to be interrupted •  Master server can rotate journal file •  Specify ‘-J prefix’ if master uses journal prefix for checkpoints •  rdb.lbr database •  Binary file located in the replica P4ROOT directory •  Contains information on missing archive revisions
  • 8. JOURNAL ROTATION AND PREFIX •  Master •  p4 admin checkpoint/journal [-z] prefix •  Do not use –z (compression)! •  If you use a prefix, use the same prefix for ‘p4 pull’ •  Replica •  p4 pull –J prefix [-i <N>] •  Journal will rotated in sync with the master (in P4ROOT)
  • 9. CONFIGURATION •  ‘p4 pull’ is designed to be a background process •  Started from the replica server •  One process for retrieving metadata •  Several additional processes to retrieve archive data •  Use the new ‘p4 configure set’ •  p4 configure set monitor=3 •  p4 configure set repl1#statefile=repl1_state
  • 10. PREPARE IN THE MASTER P4NAME=Master P4NAME=Repl_1 checkpoint restore monitor=1 monitor=1 Repl_1#monitor=3 Repl_1#monitor=3 Repl_1#P4TARGET=master:1666 Repl_1#P4TARGET=master:1666 Repl_1#P4PORT=repl1:1666 Repl_1#P4PORT=repl1:1666 Repl_1#P4LOG=repl1_log Repl_1#P4LOG=repl1_log Repl_2#monitor=3 Repl_2#monitor=3 Repl_2#P4TARGET=master:1666 Repl_2#P4TARGET=master:1666 Repl_2#P4PORT=repl2:1999 Repl_2#P4PORT=repl2:1999 Repl_2#P4LOG=repl2_log Repl_2#P4LOG=repl2_log P4NAME determines which configuration is active
  • 11. CONFIGURATION PARAMETERS Parameter Values (examples) P4PORT 1666 P4TARGET master:1666 db.replication readonly lbr.replication readonly serviceUser service_replica monitor 1 startup.1 pull –i 1[-J prefix] startup.2 pull –u –i 1 startup.3 pull –u –i 1
  • 12. SERVICEUSER •  Special user for background processes •  Type: Service •  Ignores AUTH_CHECK trigger, local password instead •  Needs entry in the protection table, typically ‘super’ •  Does not consume a license •  Can only run a few limited commands p4 login p4 logout p4 passwd p4 info p4 user •  Needs to be logged in before replication can start •  P4TICKETS
  • 13. MONITORING •  p4 monitor show –a (on replica) •  695 R service 72:22:23 pull -i 1 •  696 R service 72:22:23 pull -u -i 1 •  697 R service 72:22:23 pull -u -i 1 •  p4 logtail (on master, with server=1..3) •  rmt-Journal •  rmt-FileFetch •  p4 pull –l •  Reports pending archive file transfers •  p4 verify
  • 14. CONNECT TO THE REPLICA •  Replica is read-only •  ‘p4 login’ requires database change for ticket •  Solution: •  Replica forwards request to Master •  ‘p4 pull’ retrieves ticket from Master •  ‘p4 login’ can experience delay •  Alternative: P4AUTH pointing to master server •  Faster in LAN, but slower in WAN
  • 15. COMMANDS ON THE REPLICA •  Only read-only commands are allowed •  ‘p4 sync –p’, ‘p4 print’, but not ‘p4 sync’ •  Clients used against the replica must be created on the master server •  Will be replicated across •  Timestamps do not get updated
  • 16. USE CASES: HIGH AVAILABILITY •  Recommended: identical hardware to master •  Asynchronous solution: •  Replica can be a few seconds behind master •  HA server usually within the same LAN •  Failover procedure: •  Stop replica •  Restart with P4NAME set to master name •  è Replica becomes the master •  Currently no fallback to former master •  Need to build a new replica •  Do not automate failover!
  • 18. USE CASES: DISASTER RECOVERY •  Hardware requirements typically less than HA •  DR Server is not expected to handle the same load •  DR replica can be several minutes behind master •  DR server needs to be physically separated from master •  RPO (recovery point objective) depends on bandwidth •  Failover scenarios similar to HA
  • 19. USE CASES: BUILD SERVER •  Usable for full builds •  No incremental file update of the workspace •  Need to use ‘p4 sync –p’ or ‘p4 print’ to retrieve files •  Use long-lasting ticket or P4AUTH to avoid delay waiting for ‘p4 login’ •  Can use P4Broker to redirect read-only commands to replica (http://kb.perforce.com/article/1354) •  Alternative to P4Proxy for builds
  • 20. USE CASES: REPORTING •  Reporting does not require access to archive files •  Reporting replica: •  lbr.replication=none •  No ‘p4 pull –u’ background tasks •  Can also be used with P4Broker •  Use ‘p4 replicate’ instead of ‘p4 pull’ to filter •  No background task, needs to be run separately
  • 21. THE FUTURE •  Backup using replica server •  Missing link between replica checkpoint and master journal •  Federated servers •  Advanced proxy with some Metadata •  Better reporting and recovery options