Skip to content

tile data read very slowly #723

@kobeyk

Description

@kobeyk

Excuse me, I have a problem,I converted a cog tif with rio-cogeo and put it locally, then read it with rio-tiler, and ran it with py code alone, and found that the reading process took a long time, >600ms, in fact, normal tif is very fast when read with gdal, I would like to know why this piece is slow. Here's how long it takes to run alone:

1724836230109

code:

import os
os.environ['PROJ_LIB'] = r"D:\Anaconda\Anaconda3\envs\gdal3.6\Lib\site-packages\pyproj\proj_dir\share\proj"
import time
from rio_tiler.io import Reader
from rio_tiler.mosaic import mosaic_reader
def reader(file, x, y, z, **kwargs):
    startTime = time.perf_counter()
    image = Reader(file)
    elapsedTime = time.perf_counter() - startTime
    print(f"The code took {elapsedTime} seconds to read.")
    startTime = time.perf_counter()
    buff = image.tile(x, y, z, **kwargs)
    elapsedTime = time.perf_counter() - startTime
    print(f"The code took {elapsedTime} seconds to render.")
    image.close()
    return buff
cogList = [
   r"D:\gdm\image\shanghai\GF1D_PMS_E121.0_N31.9_20230523_L5A_1257227139\GF1D_PMS_E121.0_N31.9_20230523_L5B_1257227139.cog.tif",
]

x = 1714
y = 834
z = 11
img, assets = mosaic_reader(cogList, reader, x,y,z)
buff = img.render(img_format="webp")
with open("./images/slow.png", "wb") as f:
        f.write(buff)

In addition, I also used java to write a server to call python code, and wrote a front-end test. I found that cog as a image tile service, its performance is really a little too slow, I want to know, as cog data, whether it supports multi-user concurrent access? Is it possible to improve access efficiency by setting some parameters for tuning? In other words, in order to provide high-quality image tile services, it can only be carried out in accordance with the traditional slicing method. Below is a screenshot of the response time of the front-end call:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions