Build and use subdomain environment


Introduction

Because the browser has a limit on the number of concurrent requests for the same domain name service, by deploying multiple subdomains, the concurrent amount of data requests sent to iServer is increased, so as to achieve the purpose of increasing the loading speed. The following takes nginx as an example to build the environment:

    • Description: Use the nginx client to map different port addresses to access iServer, build a subdomain environment, and improve performance.
    • Application scenario: Make full use of the hardware performance of the server machine, increase the amount of concurrency, and improve the loading speed.

Applying

1. Nginx client deployment.

Modify the nginx.conf file, as shown in the figure below, restart nginx after the modification is completed, then http://localhost:8081/iserver, http://localhost:8082/iserver, http://localhost:8083/iserver Will point to http://localhost:8090/iserver

2. scen.open()Open Scene

        var promise = viewer.scene.open('http://{s}/iserver/services/3D-CBD/rest/realspace', undefined, {
            subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域
        });
        

3. scene.addS3MTilesLayerByScp()Add model

        var config = {
            subdomainConfig: {
                urlScheme: " http://{s}/iserver/services/3D-CBD/rest/realspace",
                subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域
            },
            name: "building"
        };

        var promise = viewer.scene.addS3MTilesLayerByScp('http://localhost:8090/iserver/services/3D-CBD/rest/realspace/datas/building/config', config);
        SuperMap3D.when(promise, function (layer) {
            viewer.flyTo(promise);
        })
    

4. Terrain

        var viewer = new SuperMap3D.Viewer('Container', {
            terrainProvider: new SuperMap3D.SuperMapTerrainProvider({
                url: ' http://{s}/iserver/services/3D-terrain/rest/realspace/datas/dem',
                subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域
            })
        });
    

5. Imagery

        var imageLayer = viewer.imageryLayers.addImageryProvider(new SuperMap3D.SuperMapImageryProvider({
            url: ' http://{s}/iserver/services/3D-image/rest/realspace/datas/image',
            subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域
        }));
        viewer.flyTo(imageLayer);
        

6、mvt

    mvtMap = scene.addVectorTilesMap({
    url: 'http://{s}/services/map-mvt-JingJinDiQuDiTu/restjsr/v1/vectortile/maps/JingJin',
    subdomains: ['localhost:8081', 'localhost:8082', 'localhost:8083']//设置子域
    canvasWidth: 512,
    name: 'testMVT',
    viewer: viewer
});

                    

Loading effect: See if there are requests for different ports from the network request, such as'localhost:8081','localhost:8082','localhost:8083'

Copyright © 2000-2023 SuperMap Software Co., Ltd. All rights reserved Beijing Public Network Security 11010502008721 A test capital word 11002074