Search in sources :

Example 26 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster 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));
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 27 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ContentBuilderTest method canConfigureMmapNoCoreLimit.

@Test
public void canConfigureMmapNoCoreLimit() throws Exception {
    ContentCluster b = createContent("<content version =\"1.0\" id=\"b\">" + "    <redundancy>2</redundancy>" + "      <documents>" + "        <document type='music' mode='index'/>" + "      </documents>" + "    <group mmap-core-limit=\"200000\">" + "      <node hostalias=\"mockhost\" distribution-key=\"0\" />" + "      <node hostalias=\"mockhost\" distribution-key=\"1\" />" + "    </group>" + "</content>");
    ContentSearchCluster s;
    s = b.getSearch();
    assertTrue(s.hasIndexedCluster());
    assertNotNull(s.getIndexed());
    assertEquals(2, b.getStorageNodes().getChildren().size());
    assertTrue(b.getRootGroup().getMmapNoCoreLimit().isPresent());
    assertEquals(200000, b.getRootGroup().getMmapNoCoreLimit().get().longValue());
    assertThat(s.getSearchNodes().size(), is(2));
    assertEquals(200000, s.getSearchNodes().get(0).getMMapNoCoreLimit());
    assertEquals(200000, s.getSearchNodes().get(1).getMMapNoCoreLimit());
    assertEquals("VESPA_MMAP_NOCORE_LIMIT=200000 ", s.getSearchNodes().get(0).getMMapNoCoreEnvVariable());
    assertEquals("VESPA_MMAP_NOCORE_LIMIT=200000 ", s.getSearchNodes().get(1).getMMapNoCoreEnvVariable());
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 28 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ContentBuilderTest method handleSingleNonSearchPersistentVds.

@Test
public void handleSingleNonSearchPersistentVds() throws Exception {
    ContentCluster a = createContent("<content version =\"1.0\" id=\"a\">" + "    <redundancy>3</redundancy>" + "    <documents>" + "       <document type=\"music\" mode=\"store-only\"/>" + "    </documents>" + "    <engine>" + "      <vds/>" + "    </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 VDSEngine.Factory);
    assertEquals(1, a.getStorageNodes().getChildren().size());
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) VDSEngine(com.yahoo.vespa.model.content.engines.VDSEngine) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 29 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ContentBuilderTest method handleSingleNonSearchPersistentDummy.

@Test
public void handleSingleNonSearchPersistentDummy() throws Exception {
    ContentCluster a = createContent("<content version =\"1.0\" id=\"a\">" + "    <redundancy>3</redundancy>" + "    <documents>" + "       <document type=\"music\" mode=\"store-only\"/>" + "    </documents>" + "    <engine>" + "      <dummy/>" + "    </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 com.yahoo.vespa.model.content.engines.DummyPersistence.Factory);
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 30 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class MultilevelDispatchTest method requireThatDispatchGroupsCanBeExplicitlySpecified.

@Test
public void requireThatDispatchGroupsCanBeExplicitlySpecified() throws Exception {
    ContentCluster cr = createCluster(getDispatchXml());
    IndexedSearchCluster ix = cr.getSearch().getIndexed();
    Dispatch tld = cr.getSearch().getIndexed().getTLDs().get(0);
    assertEquals("tlds/tld.0", tld.getConfigId());
    assertEquals(0, getFdispatchrcConfig(tld).dispatchlevel());
    new EngineAsserter(2, 6, tld).assertEngine(0, 0, "tcp/mh0:19113").assertEngine(1, 0, "tcp/mh2:19113").assertEngine(2, 0, "tcp/mh4:19113").assertEngine(0, 1, "tcp/mh1:19113").assertEngine(1, 1, "tcp/mh3:19113").assertEngine(2, 1, "tcp/mh5:19113");
    List<Dispatch> ds = getDispatchers(tld);
    assertEquals(6, ds.size());
    {
        // dispatch group 1
        Dispatch[] dispatchers = { ds.get(0), ds.get(1), ds.get(2) };
        String[] specs = { "tcp/mh0:19104", "tcp/mh2:19104", "tcp/mh4:19104" };
        SearchNode[] searchNodes = { ix.getSearchNode(0), ix.getSearchNode(2), ix.getSearchNode(4) };
        assertDispatchAndSearchNodes(0, dispatchers, specs, searchNodes);
    }
    {
        // dispatch group 2
        Dispatch[] dispatchers = { ds.get(3), ds.get(4), ds.get(5) };
        String[] specs = { "tcp/mh1:19104", "tcp/mh3:19104", "tcp/mh5:19104" };
        SearchNode[] searchNodes = { ix.getSearchNode(1), ix.getSearchNode(3), ix.getSearchNode(5) };
        assertDispatchAndSearchNodes(1, dispatchers, specs, searchNodes);
    }
}
Also used : ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Aggregations

ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)83 Test (org.junit.Test)70 VespaModel (com.yahoo.vespa.model.VespaModel)22 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)20 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)18 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)15 MockRoot (com.yahoo.config.model.test.MockRoot)7 ContentClusterBuilder (com.yahoo.vespa.model.content.utils.ContentClusterBuilder)7 SearchDefinitionBuilder (com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder)6 PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)5 HostResource (com.yahoo.vespa.model.HostResource)5 SearchNode (com.yahoo.vespa.model.search.SearchNode)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 StorDistributionConfig (com.yahoo.vespa.config.content.StorDistributionConfig)4 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)4 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)4 VDSEngine (com.yahoo.vespa.model.content.engines.VDSEngine)4 StorServerConfig (com.yahoo.vespa.config.content.core.StorServerConfig)3 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)2