Skip to content
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
5 changes: 4 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ function StopOnFailedExecution {
}
}

$skipCliDownload = $args[0]

$currDir = Get-Location

Write-Host "Building azure-function-java-worker"
cmd.exe /c '.\mvnBuild.bat'
StopOnFailedExecution

Write-Host "Starting azure-functions-java-endtoendtests execution"
.\setup-tests.ps1
Write-Host s$cliDownload
.\setup-tests.ps1 $skipCliDownload
$proc = start-process -filepath $currDir\Azure.Functions.Cli\func.exe -WorkingDirectory "$currDir\endtoendtests\target\azure-functions\azure-functions-java-endtoendtests" -ArgumentList "host start" -PassThru

# wait for host to start
Expand Down
2 changes: 1 addition & 1 deletion endtoendtests/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Microsoft Azure Functions in Java
# Azure Functions in Java

This repo contains several Java Azure Functions samples for different events.

Expand Down
2 changes: 1 addition & 1 deletion endtoendtests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<azure.functions.maven.plugin.version>1.0.0-beta-8-SNAPSHOT</azure.functions.maven.plugin.version>
<azure.functions.maven.plugin.version>1.2.0-SNAPSHOT</azure.functions.maven.plugin.version>
<azure.functions.java.library.version>1.0.0-beta-7-SNAPSHOT</azure.functions.java.library.version>
<functionAppName>azure-functions-java-endtoendtests</functionAppName>
<functionAppRegion>westus</functionAppRegion>
Expand Down
14 changes: 12 additions & 2 deletions setup-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@ function StopOnFailedExecution {
exit $LastExitCode
}
}
Write-Host "$args[0]"
Write-Host $args[0]

$currDir = Get-Location
$skipCliDownload = $false
if($args[0])
{
$skipCliDownload = $args[0]
}
Write-Host $skipCliDownload

$currDir = Get-Location
if(!$skipCliDownload)
{
Write-Host "Deleting Functions Core Tools if exists...."
Remove-Item -Force ./Azure.Functions.Cli.zip -ErrorAction Ignore
Remove-Item -Recurse -Force ./Azure.Functions.Cli -ErrorAction Ignore
Expand All @@ -25,7 +35,7 @@ $wc.DownloadFile($url, $output)

Write-Host "Extracting Functions Core Tools...."
Expand-Archive ".\Azure.Functions.Cli.zip" -DestinationPath ".\Azure.Functions.Cli"

}
Write-Host "Copying azure-functions-java-worker to Functions Host workers directory...."
Get-ChildItem -Path .\target\* -Include 'azure*' -Exclude '*shaded.jar' | %{ Copy-Item $_.FullName ".\Azure.Functions.Cli\workers\java\azure-functions-java-worker.jar" }
Copy-Item ".\worker.config.json" ".\Azure.Functions.Cli\workers\java"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void close() throws Exception {
private class StreamingMessagePeer implements StreamObserver<StreamingMessage>, AutoCloseable {
StreamingMessagePeer() {
this.task = new CompletableFuture<>();
this.threadpool = Executors.newWorkStealingPool();
this.threadpool = Executors.newCachedThreadPool();
Copy link
Member Author

@pragnagopa pragnagopa Nov 7, 2018

Choose a reason for hiding this comment

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

@selvasingh - Changing the Executor helps a little but no significant improvement. RPS went from 60. Let me know if you have any other ideas

Copy link
Member Author

Choose a reason for hiding this comment

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

I have already verified, invocation requests are handled on a new thread.

this.observer = FunctionRpcGrpc.newStub(JavaWorkerClient.this.channel).eventStream(this);
}

Expand All @@ -87,10 +87,10 @@ public synchronized void close() throws Exception {
public void onNext(StreamingMessage message) {
MessageHandler<?, ?> handler = JavaWorkerClient.this.handlerSuppliers.get(message.getContentCase()).get();
handler.setRequest(message);
handler.registerTask(this.threadpool.submit(() -> {
this.threadpool.submit(() -> {
handler.handle();
this.send(message.getRequestId(), handler);
}));
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ String execute(InvocationRequest request, InvocationResponse.Builder response) t

this.invocationLogger = WorkerLogManager.getInvocationLogger(invocationId);
response.setInvocationId(invocationId);

List<ParameterBinding> outputBindings = new ArrayList<>();
this.broker.invokeMethod(functionId, request, outputBindings).ifPresent(response::setReturnValue);
response.addAllOutputData(outputBindings);

return String.format("Function \"%s\" (ID: %s) invoked by Java Worker",
this.broker.getMethodName(functionId).orElse("UNKNOWN"), functionId);
return String.format("Function \"%s\" (Id: %s) invoked by Java Worker",
this.broker.getMethodName(functionId).orElse("UNKNOWN"), invocationId);
}

private JavaFunctionBroker broker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ public void handle() {
this.responseStatusMarshaller.accept(this.response, result.build());
}
}

public void registerTask(Future<?> task) { }

Logger getLogger() { return WorkerLogManager.getHostLogger(); }
abstract String execute(TRequest request, TResponse response) throws Exception;

Expand Down