Skip to content

Commit 93ddf52

Browse files
committed
geotiff zip: disable compression, add log messages
log messages to assist in determining cause of slow file creation
1 parent 3e0e7f4 commit 93ddf52

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/java/com/conveyal/analysis/controllers/RegionalAnalysisController.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,22 @@ private Object getAllRegionalResults (Request req, Response res) throws IOExcept
302302
// Examining ZipFileSystemProvider reveals a "useTempFile" env parameter, but this is for the individual
303303
// entries. May be better to just use zipOutputStream which would also allow gzip - zip CSV conversion.
304304
tempZipFile.delete();
305-
Map<String, String> env = Map.of("create", "true");
306305
URI uri = URI.create("jar:file:" + tempZipFile.getAbsolutePath());
306+
// GeoTiffs are already compressed.
307+
// NoCompression reduces ZIP write time from 400 to 8 msec at a 1.5% cost in file size.
308+
Map<String, String> env = Map.of("create", "true", "noCompression", "true");
309+
LOG.info("Adding {} GeoTiffs to ZIP file {}...", humanKeys.size(), tempZipFile.getName());
307310
try (FileSystem zipFilesystem = FileSystems.newFileSystem(uri, env)) {
308311
for (HumanKey key : humanKeys) {
309312
Path storagePath = fileStorage.getFile(key.storageKey).toPath();
310313
Path zipPath = zipFilesystem.getPath(key.humanName);
311314
Files.copy(storagePath, zipPath, StandardCopyOption.REPLACE_EXISTING);
315+
LOG.info("Added GeoTiff for key {}", key.humanName);
312316
}
313317
}
318+
LOG.info("Moving ZIP into storage...");
314319
fileStorage.moveIntoStorage(zippedResultsKey, tempZipFile);
320+
LOG.info("Done moving ZIP into storage.");
315321
}
316322
res.type(APPLICATION_JSON.asString());
317323
String analysisHumanName = humanNameForEntity(analysis);

0 commit comments

Comments
 (0)