google-nomulus/java/google/registry/config/RegistryConfigSettings.java
mcilwain ce136f9285 Add short-term host/contact caching for high-QPS domain mutations
After investigating common domain create/update command usage
patterns by registrars, we noticed that it is frequent for a
given registrar to reuse both hosts (using a standardized set of
nameservers) as well as contacts (e.g. for privacy/proxy
services). With these usage patterns, potential per-registrar
throughput during high volume scenarios (i.e. first moments of
General Availability) suffers from hitting hot keys in Datastore.

The solution, implemented in this CL, is to add short-term
in-memory caching for contacts and hosts, analogous to how we are
already caching Registry and Registrar entities.  These new
cached paths are only used inside domain flows to determine
existence and deleted/pending delete status of contacts and
hosts. This is a potential loss of transactional consistency, but
in practice it's hard to imagine this having negative effects, as
contacts or hosts that are in use cannot be deleted, and caching
would primarily affect widely used contacts and hosts.

Note that this caching can be turned on or off through a
configuration option, and by default would be off. We'd only want
it on when we really needed it, i.e. during a big launch.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187093378
2018-03-06 19:05:20 -05:00

171 lines
5.3 KiB
Java

// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.config;
import java.util.List;
import java.util.Map;
/** The POJO that YAML config files are deserialized into. */
public class RegistryConfigSettings {
public AppEngine appEngine;
public GSuite gSuite;
public OAuth oAuth;
public RegistryPolicy registryPolicy;
public Datastore datastore;
public CloudDns cloudDns;
public Caching caching;
public IcannReporting icannReporting;
public Billing billing;
public Rde rde;
public RegistrarConsole registrarConsole;
public Monitoring monitoring;
public Misc misc;
public Braintree braintree;
public Kms kms;
public RegistryTool registryTool;
/** Configuration options that apply to the entire App Engine project. */
public static class AppEngine {
public String projectId;
public ToolsServiceUrl toolsServiceUrl;
/** Configuration options for the tools service URL. */
public static class ToolsServiceUrl {
public String hostName;
public int port;
}
}
/** Configuration options for OAuth settings. */
public static class OAuth {
public List<String> availableOauthScopes;
public List<String> requiredOauthScopes;
public List<String> allowedOauthClientIds;
}
/** Configuration options for the G Suite account used by Nomulus. */
public static class GSuite {
public String domainName;
public String outgoingEmailAddress;
public String outgoingEmailDisplayName;
public String adminAccountEmailAddress;
}
/** Configuration options for registry policy. */
public static class RegistryPolicy {
public String contactAndHostRoidSuffix;
public String productName;
public String customLogicFactoryClass;
public String whoisCommandFactoryClass;
public String allocationTokenCustomLogicClass;
public int contactAutomaticTransferDays;
public String greetingServerId;
public List<String> registrarChangesNotificationEmailAddresses;
public String defaultRegistrarWhoisServer;
public String defaultRegistrarReferralUrl;
public String tmchCaMode;
public String tmchCrlUrl;
public String tmchMarksDbUrl;
public String checkApiServletClientId;
public String registryAdminClientId;
public String reservedTermsExportDisclaimer;
public String whoisDisclaimer;
}
/** Configuration for Cloud Datastore. */
public static class Datastore {
public int commitLogBucketsNum;
public int eppResourceIndexBucketsNum;
public int baseOfyRetryMillis;
}
/** Configuration for Cloud KMS. */
public static class Kms {
public String keyringName;
public String projectId;
}
/** Configuration for Cloud DNS. */
public static class CloudDns {
public String rootUrl;
public String servicePath;
}
/** Configuration for caching. */
public static class Caching {
public int singletonCacheRefreshSeconds;
public int domainLabelCachingSeconds;
public int singletonCachePersistSeconds;
public int staticPremiumListMaxCachedEntries;
public boolean eppResourceCachingEnabled;
public int eppResourceCachingSeconds;
public int eppResourceMaxCachedEntries;
}
/** Configuration for ICANN monthly reporting. */
public static class IcannReporting {
public String icannTransactionsReportingUploadUrl;
public String icannActivityReportingUploadUrl;
}
/** Configuration for monthly invoices. */
public static class Billing {
public List<String> invoiceEmailRecipients;
}
/** Configuration for Registry Data Escrow (RDE). */
public static class Rde {
public String reportUrlPrefix;
public String uploadUrl;
public String sshIdentityEmailAddress;
}
/** Configuration for the web-based registrar console. */
public static class RegistrarConsole {
public String logoFilename;
public String supportPhoneNumber;
public String supportEmailAddress;
public String announcementsEmailAddress;
public String integrationEmailAddress;
public String technicalDocsUrl;
}
/** Configuration for monitoring. */
public static class Monitoring {
public int stackdriverMaxQps;
public int stackdriverMaxPointsPerRequest;
public int writeIntervalSeconds;
}
/** Miscellaneous configuration that doesn't quite fit in anywhere else. */
public static class Misc {
public String sheetExportId;
public String alertRecipientEmailAddress;
public String alertEmailSenderDomain;
}
/** Configuration for Braintree credit card payment processing. */
public static class Braintree {
public String merchantId;
public String publicKey;
public Map<String, String> merchantAccountIdsMap;
}
/** Configuration options for the registry tool. */
public static class RegistryTool {
public String clientSecretFilename;
}
}