Skip to content

Commit

Permalink
feat: try whether also caching aggregated queries makes cov spectrum …
Browse files Browse the repository at this point in the history
…faster
  • Loading branch information
fengelniederhammer authored and JonasKellerer committed Mar 5, 2024
1 parent e0439f9 commit bbfaf22
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ description: LAPIS' caching concept

import CacheSizeEndpointLink from '../../../../components/CacheSizeEndpointLink.astro';

LAPIS uses Spring Boot's caching capabilities to cache insertion and mutation queries.
LAPIS uses Spring Boot's caching capabilities to cache aggregated, insertion and mutation queries.
We decided to cache SILO actions that are relatively expensive to compute,
but don't return much data (measured in size of the response body).

At the time of writing, we think that aggregated queries are fast enough to not require caching.
Details and FASTA actions are more expensive, but return potentially large amounts of data.
Details and FASTA actions are expensive, but return potentially large amounts of data.

LAPIS offers an endpoint to check the current cache size (in number of cached entries) at `/actuator/metrics/cache.size`:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ sealed class SiloAction<ResponseType>(
override val limit: Int? = null,
override val offset: Int? = null,
val type: String = "Aggregated",
) : SiloAction<List<AggregationData>>(AggregationDataTypeReference(), cacheable = false)
) : SiloAction<List<AggregationData>>(AggregationDataTypeReference(), cacheable = true)

@JsonInclude(JsonInclude.Include.NON_EMPTY)
private data class MutationsAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,14 @@ class SiloClientTest(
companion object {
@JvmStatic
val queriesThatShouldNotBeCached = listOf(
SiloQuery(SiloAction.aggregated(), True),
SiloQuery(SiloAction.details(), True),
SiloQuery(SiloAction.genomicSequence(SequenceType.ALIGNED, "sequenceName"), True),
SiloQuery(SiloAction.genomicSequence(SequenceType.UNALIGNED, "sequenceName"), True),
)

@JvmStatic
val queriesThatShouldBeCached = listOf(
SiloQuery(SiloAction.aggregated(), True),
SiloQuery(SiloAction.mutations(), True),
SiloQuery(SiloAction.aminoAcidMutations(), True),
SiloQuery(SiloAction.nucleotideInsertions(), True),
Expand All @@ -479,7 +479,6 @@ class SiloClientAndCacheInvalidatorTest(
private lateinit var mockServer: ClientAndServer

val someQuery = SiloQuery(SiloAction.mutations(), True)
val anotherQuery = SiloQuery(SiloAction.aminoAcidMutations(), True)
val firstDataVersion = "1"
val secondDataVersion = "2"

Expand Down

0 comments on commit bbfaf22

Please sign in to comment.