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

Improve parallel processing #68

Merged
merged 3 commits into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ VOLUME /app/glutton-source/.gradle

# source
COPY lookup/ ./lookup/
COPY matching/ ./matching/
COPY indexing/ ./indexing/

RUN cd /app/glutton-source/lookup && ./gradlew clean assemble --no-daemon

Expand All @@ -31,10 +31,9 @@ RUN apt-get update -qq && apt-get -qy install curl build-essential unzip
RUN mkdir -p /app
WORKDIR /app

RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get update -qq && apt-get -y install nodejs
COPY --from=builder /app/glutton-source/matching /app/matching
RUN cd matching; npm install
RUN apt-get update -qq && apt-get -y install nodejs npm
COPY --from=builder /app/glutton-source/indexing /app/indexing
RUN cd indexing; npm install

COPY --from=builder /app/glutton-source/lookup/build/distributions/lookup-service-shadow-*.zip ./lookup-service.zip

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public class Elastic {

private String host;
private String index;
private int maxConnections = 10;

public String getHost() {
return host;
Expand All @@ -191,6 +192,14 @@ public String getIndex() {
public void setIndex(String index) {
this.index = index;
}

public int getMaxConnections() {
return maxConnections;
}

public void setMaxConnections(int maxConnections) {
this.maxConnections = maxConnections;
}
}

public class Crossref {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ public MetadataMatching(LookupConfiguration configuration, MetadataLookup metada
.setRequestConfigCallback(
requestConfigBuilder -> requestConfigBuilder
.setConnectTimeout(30000)
.setSocketTimeout(60000)));
.setSocketTimeout(60000))
.setHttpClientConfigCallback(
httpAsyncClientBuilder -> httpAsyncClientBuilder
.setMaxConnPerRoute(configuration.getElastic().getMaxConnections())
.setMaxConnTotal(configuration.getElastic().getMaxConnections())));

// note: maxRetryTimeoutMillis is deprecated in ES 7 due to implementation issue
// https://github.com/elastic/elasticsearch/pull/38085
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ protected void processByQuery(
}
});
return;
} else {
asyncResponse.resume(matchingDocument.getException());
return;
}
} else {
asyncResponse.resume(matchingDocument.getFinalJsonObject());
Expand Down