Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accelerate generic assay endpoint response speed #7617

Merged
merged 1 commit into from
Jun 15, 2020

Conversation

dippindots
Copy link
Member

@dippindots dippindots commented Jun 15, 2020

Fix #7448
Result: take ccle_broad_2019 as an example, response time dropped from 9s-10s to 0.3-0.5s.

This pr will address the issue that causes the slowness of generic assay endpoint.
The issue is: the mybatis mapper will be called (2 * number of stable ids) times. So the response speed is very slow.

Describe changes proposed in this pull request:

  • call mapper just one time
  • update related unit tests

@dippindots dippindots self-assigned this Jun 15, 2020
Comment on lines +78 to +90
List<GenericAssayAdditionalProperty> additionalProperties = genericAssayRepository.getGenericAssayAdditionalproperties(distinctStableIds);
for (GenericAssayMeta meta : metaData) {
int geneticEntityId = genericAssayRepository.getGeneticEntityIdByStableId(meta.getStableId());
String stableId = meta.getStableId();
HashMap<String, String> map = new HashMap<>();
for (HashMap<String, String> data : genericAssayRepository.getGenericAssayMetaPropertiesMap(geneticEntityId)) {
map.put(data.get("key"), data.get("value"));
List<GenericAssayAdditionalProperty> filteredAdditionalProperties = additionalProperties
.stream()
.filter(additionalProperty -> additionalProperty.getStableId().equals(stableId))
.collect(Collectors.toList());
for (GenericAssayAdditionalProperty additionalProperty : filteredAdditionalProperties) {
map.put(additionalProperty.getName(), additionalProperty.getValue());
}
metaResults.add(new GenericAssayMeta(meta.getEntityType(), meta.getStableId(), map));
meta.setGenericEntityMetaProperties(map);
metaResults.add(meta);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main change is at here: we call function getGenericAssayAdditionalproperties once instead of calling N times getGeneticEntityIdByStableId and getGenericAssayMetaPropertiesMap (N is the number of stable ids).

@dippindots dippindots merged commit bd5f292 into cBioPortal:master Jun 15, 2020
@dippindots dippindots deleted the speed-up-generic-assay branch June 15, 2020 16:51
@inodb inodb added the cl-performance Performance enhancement section of changelog label Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cl-performance Performance enhancement section of changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accelerate the response speed of generic assay meta endpoint
3 participants