use of com.yahoo.vespa.model.content.ContentSearchCluster in project vespa by vespa-engine.
the class ModelProvisioningTest method require_that_proton_config_is_tuned_based_on_node_flavor.
@Test
public void require_that_proton_config_is_tuned_based_on_node_flavor() {
String services = joinLines("<?xml version='1.0' encoding='utf-8' ?>", "<services>", " <content version='1.0' id='test'>", " <documents>", " <document type='type1' mode='index'/>", " </documents>", " <nodes count='2' flavor='content-test-flavor'/>", " </content>", "</services>");
VespaModelTester tester = new VespaModelTester();
tester.addHosts(createFlavorFromDiskSetting("content-test-flavor", false), 2);
VespaModel model = tester.createModel(services, true, 0);
ContentSearchCluster cluster = model.getContentClusters().get("test").getSearch();
assertEquals(2, cluster.getSearchNodes().size());
assertEquals(40, getProtonConfig(cluster, 0).hwinfo().disk().writespeed(), 0.001);
assertEquals(40, getProtonConfig(cluster, 1).hwinfo().disk().writespeed(), 0.001);
}
use of com.yahoo.vespa.model.content.ContentSearchCluster in project vespa by vespa-engine.
the class ContentBuilderTest method handleIndexedWithoutPersistence.
@Test
public void handleIndexedWithoutPersistence() throws Exception {
ContentCluster b = createContent("<content version =\"1.0\" id=\"b\">" + " <redundancy>3</redundancy>" + " <documents>" + " <document type='music' mode='index'/>" + " </documents>" + " <group>" + " <node hostalias=\"mockhost\" distribution-key=\"0\"/>" + " </group>" + "</content>");
ContentSearchCluster s;
s = b.getSearch();
assertTrue(s.hasIndexedCluster());
assertEquals(1, s.getClusters().size());
assertNotNull(s.getIndexed());
assertEquals("b", s.getIndexed().getClusterName());
assertTrue(b.getPersistence() instanceof ProtonEngine.Factory);
assertEquals(1, b.getStorageNodes().getChildren().size());
assertEquals("b", b.getConfigId());
// assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId());
// Due to reuse.
assertEquals("b/storage/0", b.getRootGroup().getNodes().get(0).getConfigId());
assertEquals(1, b.getRoot().getHostSystem().getHosts().size());
HostResource h = b.getRoot().getHostSystem().getHost("mockhost");
assertEquals("b/storage/0", h.getService("storagenode").getConfigId());
}
use of com.yahoo.vespa.model.content.ContentSearchCluster in project vespa by vespa-engine.
the class ContentBuilderTest method handleSingleNonSearchPersistentProton.
@Test
public void handleSingleNonSearchPersistentProton() throws Exception {
ContentCluster a = createContent("<content version =\"1.0\" id=\"a\">" + " <redundancy>3</redundancy>" + " <documents>" + " <document type=\"music\" mode=\"store-only\"/>" + " </documents>" + " <engine>" + " <proton/>" + " </engine>" + " <group>" + " <node hostalias=\"mockhost\" distribution-key=\"0\"/>" + " </group>" + "</content>");
ContentSearchCluster s = a.getSearch();
assertFalse(s.hasIndexedCluster());
assertTrue(s.getClusters().isEmpty());
assertTrue(a.getPersistence() instanceof ProtonEngine.Factory);
assertEquals(1, a.getStorageNodes().getChildren().size());
}
use of com.yahoo.vespa.model.content.ContentSearchCluster in project vespa by vespa-engine.
the class ContentBuilderTest method handleIndexedOnlyWithoutPersistence.
@Test
public void handleIndexedOnlyWithoutPersistence() throws Exception {
VespaModel m = new VespaModelCreatorWithMockPkg(createAppWithMusic(getHosts(), getBasicServices())).create();
ContentCluster c = CollectionUtil.first(m.getContentClusters().values());
ContentSearchCluster s = c.getSearch();
assertTrue(s.hasIndexedCluster());
assertEquals(1, s.getClusters().size());
assertNotNull(s.getIndexed());
assertEquals("clu", s.getIndexed().getClusterName());
assertEquals(7.3, s.getIndexed().getQueryTimeout(), 0.0);
assertTrue(c.getPersistence() instanceof ProtonEngine.Factory);
assertEquals(1, c.getStorageNodes().getChildren().size());
assertEquals("clu", c.getConfigId());
// assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId()); // This is how it should look like in an ideal world.
// Due to reuse.
assertEquals("clu/storage/0", c.getRootGroup().getNodes().get(0).getConfigId());
assertEquals(1, c.getRoot().getHostSystem().getHosts().size());
HostResource h = c.getRoot().getHostSystem().getHost("mockhost");
String[] expectedServices = { "logd", "configproxy", "config-sentinel", "qrserver", "storagenode", "searchnode", "distributor", "topleveldispatch", "transactionlogserver" };
// TODO assertServices(h, expectedServices);
assertEquals("clu/storage/0", h.getService("storagenode").getConfigId());
assertEquals("clu/search/cluster.clu/0", h.getService("searchnode").getConfigId());
assertEquals("clu/distributor/0", h.getService("distributor").getConfigId());
assertEquals("clu/search/cluster.clu/tlds/qrc.0.tld.0", h.getService("topleveldispatch").getConfigId());
// assertEquals("tcp/node0:19104", h.getService("topleveldispatch").getConfig("partitions", "").innerArray("dataset").value("0").innerArray("engine").value("0").getString("name_and_port"));
PartitionsConfig partitionsConfig = new PartitionsConfig((PartitionsConfig.Builder) m.getConfig(new PartitionsConfig.Builder(), "clu/search/cluster.clu/tlds/qrc.0.tld.0"));
assertTrue(partitionsConfig.dataset(0).engine(0).name_and_port().startsWith("tcp/node0:191"));
}
use of com.yahoo.vespa.model.content.ContentSearchCluster in project vespa by vespa-engine.
the class ContentBuilderTest method canConfigureCpuAffinityAutomatically.
@Test
public void canConfigureCpuAffinityAutomatically() throws Exception {
ContentCluster b = createContent("<content version =\"1.0\" id=\"b\">" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='music' mode='index'/>" + " </documents>" + " <group cpu-socket-affinity=\"true\">" + " <node hostalias=\"mockhost\" distribution-key=\"0\" />" + " <node hostalias=\"mockhost\" distribution-key=\"1\" />" + " <node hostalias=\"mockhost\" distribution-key=\"2\" />" + " <node hostalias=\"mockhost2\" distribution-key=\"3\" />" + " <node hostalias=\"mockhost2\" distribution-key=\"4\" />" + " <node hostalias=\"mockhost3\" distribution-key=\"5\" />" + " </group>" + "</content>");
ContentSearchCluster s;
s = b.getSearch();
assertTrue(s.hasIndexedCluster());
assertNotNull(s.getIndexed());
assertEquals(6, b.getStorageNodes().getChildren().size());
assertTrue(b.getRootGroup().useCpuSocketAffinity());
assertThat(s.getSearchNodes().size(), is(6));
assertTrue(s.getSearchNodes().get(0).getAffinity().isPresent());
assertTrue(s.getSearchNodes().get(1).getAffinity().isPresent());
assertTrue(s.getSearchNodes().get(2).getAffinity().isPresent());
assertTrue(s.getSearchNodes().get(3).getAffinity().isPresent());
assertTrue(s.getSearchNodes().get(4).getAffinity().isPresent());
assertTrue(s.getSearchNodes().get(5).getAffinity().isPresent());
assertThat(s.getSearchNodes().get(0).getAffinity().get().cpuSocket(), is(0));
assertThat(s.getSearchNodes().get(1).getAffinity().get().cpuSocket(), is(1));
assertThat(s.getSearchNodes().get(2).getAffinity().get().cpuSocket(), is(2));
assertThat(s.getSearchNodes().get(3).getAffinity().get().cpuSocket(), is(0));
assertThat(s.getSearchNodes().get(4).getAffinity().get().cpuSocket(), is(1));
assertThat(s.getSearchNodes().get(5).getAffinity().get().cpuSocket(), is(0));
// TODO: Only needed for the search nodes anyway?
assertFalse(b.getStorageNodes().getChildren().get("0").getAffinity().isPresent());
assertFalse(b.getStorageNodes().getChildren().get("1").getAffinity().isPresent());
assertFalse(b.getStorageNodes().getChildren().get("2").getAffinity().isPresent());
assertFalse(b.getStorageNodes().getChildren().get("3").getAffinity().isPresent());
assertFalse(b.getStorageNodes().getChildren().get("4").getAffinity().isPresent());
assertFalse(b.getStorageNodes().getChildren().get("5").getAffinity().isPresent());
// assertThat(b.getStorageNodes().getChildren().get("0").getAffinity().get().cpuSocket(), is(0));
// assertThat(b.getStorageNodes().getChildren().get("1").getAffinity().get().cpuSocket(), is(1));
// assertThat(b.getStorageNodes().getChildren().get("2").getAffinity().get().cpuSocket(), is(2));
// assertThat(b.getStorageNodes().getChildren().get("3").getAffinity().get().cpuSocket(), is(0));
// assertThat(b.getStorageNodes().getChildren().get("4").getAffinity().get().cpuSocket(), is(1));
// assertThat(b.getStorageNodes().getChildren().get("5").getAffinity().get().cpuSocket(), is(0));
}
Aggregations