-
Notifications
You must be signed in to change notification settings - Fork 107
Shared memory data transfer between Functions Host and Python worker #816
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
Merged
Merged
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
c83c7fe
Basic structure laid out for reading parameters from shared memory be…
c96eba9
Writing output from worker to Shared Memory
65107aa
Put output from worker into Shared Memory
d071bd8
Free shared memory resources after use
81c565c
Removed control flag from mmap header
d4ab3b0
Proto change
7de45f3
Working for blob shared memory data transfer; needs clean up, comment…
0f6ccde
Changing message for closing mmaps
c736890
Support for string datatype for shared memory data transfer
2dba4e7
Change to oneof
925cf55
Use oneof in .proto
997a1af
Refactoring mmap_handler
10648c0
Refactoring, cleaning up and adding docstrings
3ac5ef2
Updating CloseSharedMemoryResourcesResponse usage
6f2160f
Fixing accidental changes to tests/*
9398165
Addressing comments
ded4998
Basic structure laid out for reading parameters from shared memory be…
38c5502
Writing output from worker to Shared Memory
9a15243
Put output from worker into Shared Memory
fa0931d
Free shared memory resources after use
b469f2a
Removed control flag from mmap header
be814e2
Proto change
a1d5d98
Working for blob shared memory data transfer; needs clean up, comment…
af9faeb
Changing message for closing mmaps
ea3fbae
Support for string datatype for shared memory data transfer
eb33701
Change to oneof
e0fd812
Refactoring mmap_handler
beb1d23
Refactoring, cleaning up and adding docstrings
b5a7e20
Updating CloseSharedMemoryResourcesResponse usage
b0e645e
Fixing accidental changes to tests/*
a04982d
Addressing comments
84f08a2
Cleaning up, addressing comments
72b4446
Following same class structure as the shared memory changes made for …
afa115b
Moving shared memory data transfer related changes into separate dire…
26e2919
Input error checks for shared memory map ctor
6001f6c
Rebase fix
289255c
Trying to make lint happy
dca1c2c
Making flake8 happy
320eead
Merge branch 'dev' into gochaudh/shared_mem_data_transfer
ad4def0
Fixing more lint issues
4be1170
Removing the use of __annotations__ to be compatible with Python 3.6,…
bc10c1d
Added tests for FileAccessor, SharedMemoryMap, FileAccessorFactory
b07cf6a
Adding shared memory test setup for Unix
292b980
Adding tests for SharedMemoryManager
cfa943e
Adding tests to ensure the dispatcher can invoke the function and sen…
2825e11
More tests for worker/dispatcher's use of shared memory
62deedc
Using truncate instead of writing 0x00 byte manually upon creating mm…
66d53e1
Addressing comments
c4665db
Adding missing tests and doc strings for tests and their classes
dc84cf5
assertEqual -> assertTrue in test_dispose_without_delete_file
47cffb9
Tried with blob trigger function - removed TODO
52a8701
Addressing comments
db950a9
Merge branch 'dev' into gochaudh/shared_mem_data_transfer
848de3d
Minor const fix
cd75b85
Addressing comments
691a774
Fixed test - removed unused test functions
a399f2e
Addressing comments; caching list of valid directories for later use …
914bca4
Merge branch 'dev' into gochaudh/shared_mem_data_transfer
33aab5e
Whitespace fix
3c0c8a9
Cleanup
9467170
Adding AppSetting to override shared memory directory for Unix - test…
0fbca31
Logging subprocess result in Exception
050399d
Changed Exception -> IOError
dd425c5
Check shared memory directory AppSetting only for Darwin tests
3c75b31
Fix test cleanup for Darwin
4563697
Only split AppSetting list of directories if the AppSetting was found
da436e3
Fix consts.UNIX_TEMP_DIRS
ced9275
Typo fix
36797fa
Adding throughput tests for blob input/output using shared memory
598acf4
Changing branch hardcode to instead use current branch
4c38ae0
Creating tests URL from current branch name
9bffdde
Whitespace fixes
a43b3d3
Using tests from local dir
87ee40e
Removing the need to use a URL for tests; just use from local directory
04dba67
Rename env variable to follow convention from host of using FUNCTIONS_
f7df639
Addressing comments
00b36ed
Fixes for running tests on macOS
af03f2e
Merge branch 'dev' into gochaudh/shared_mem_data_transfer
ab7d488
Log which allowed directories for shared memory are being used
0e56751
Change assert -> raise
f60ae73
Merge branch 'dev' into gochaudh/shared_mem_data_transfer
Hazhzeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
.ci/perf_tests/k6scripts/SyncGetBlobAsBytesReturnHttpResponse.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { check } from "k6"; | ||
import { Rate } from "k6/metrics"; | ||
import http from "k6/http"; | ||
|
||
var HOSTNAME = __ENV.HOSTNAME || 'localhost'; | ||
var PORT = __ENV.PORT || '80'; | ||
var PROTOCOL = __ENV.PROTOCOL || (PORT === '80' ? 'http' : 'https'); | ||
var INPUT_FILENAME = 'Input_256MB' | ||
var CONTENT_SIZE = 1024 * 1024 * 256; // 256 MB | ||
|
||
// A custom metric to track failure rates | ||
var failureRate = new Rate("check_failure_rate"); | ||
|
||
// Options | ||
export let options = { | ||
stages: [ | ||
// Linearly ramp up from 1 to 20 VUs during first minute | ||
{ target: 20, duration: "1m" }, | ||
// Hold at 20 VUs for the next 3 minutes and 45 seconds | ||
{ target: 20, duration: "3m45s" }, | ||
// Linearly ramp down from 20 to 0 VUs over the last 15 seconds | ||
{ target: 0, duration: "15s" } | ||
// Total execution time will be ~5 minutes | ||
], | ||
thresholds: { | ||
// We want the 95th percentile of all HTTP request durations to be less than 40s | ||
"http_req_duration": ["p(95)<40000"], | ||
// Thresholds based on the custom metric we defined and use to track application failures | ||
"check_failure_rate": [ | ||
// Global failure rate should be less than 1% | ||
"rate<0.01", | ||
// Abort the test early if it climbs over 5% | ||
{ threshold: "rate<=0.05", abortOnFail: true }, | ||
], | ||
}, | ||
}; | ||
|
||
// Setup function | ||
// This will create a blob which will later be used as an input binding | ||
export function setup() { | ||
let no_random_input = true; | ||
let url = `${PROTOCOL}://${HOSTNAME}:${PORT}/api/SyncPutBlobAsBytesReturnHttpResponse?content_size=${CONTENT_SIZE}&no_random_input=${no_random_input}&outfile=${INPUT_FILENAME}`; | ||
let response = http.get(url); | ||
|
||
// check() returns false if any of the specified conditions fail | ||
let checkRes = check(response, { | ||
"status is 200": (r) => r.status === 200, | ||
"content_size matches": (r) => r.json().content_size === CONTENT_SIZE, | ||
}); | ||
} | ||
|
||
// Main function | ||
export default function () { | ||
let url = `${PROTOCOL}://${HOSTNAME}:${PORT}/api/SyncGetBlobAsBytesReturnHttpResponse?infile=${INPUT_FILENAME}`; | ||
let response = http.get(url); | ||
|
||
// check() returns false if any of the specified conditions fail | ||
let checkRes = check(response, { | ||
"status is 200": (r) => r.status === 200, | ||
"content_size matches": (r) => r.json().content_size === CONTENT_SIZE, | ||
}); | ||
|
||
// We reverse the check() result since we want to count the failures | ||
failureRate.add(!checkRes); | ||
} |
53 changes: 53 additions & 0 deletions
53
.ci/perf_tests/k6scripts/SyncPutBlobAsBytesReturnHttpResponse.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { check } from "k6"; | ||
import { Rate } from "k6/metrics"; | ||
import http from "k6/http"; | ||
import { randomIntBetween } from "https://jslib.k6.io/k6-utils/1.0.0/index.js"; | ||
|
||
var HOSTNAME = __ENV.HOSTNAME || 'localhost'; | ||
var PORT = __ENV.PORT || '80'; | ||
var PROTOCOL = __ENV.PROTOCOL || (PORT === '80' ? 'http' : 'https'); | ||
|
||
// A custom metric to track failure rates | ||
var failureRate = new Rate("check_failure_rate"); | ||
|
||
// Options | ||
export let options = { | ||
stages: [ | ||
// Linearly ramp up from 1 to 50 VUs during first minute | ||
{ target: 50, duration: "1m" }, | ||
// Hold at 50 VUs for the next 3 minutes and 45 seconds | ||
{ target: 50, duration: "3m45s" }, | ||
// Linearly ramp down from 50 to 0 VUs over the last 15 seconds | ||
{ target: 0, duration: "15s" } | ||
// Total execution time will be ~5 minutes | ||
], | ||
thresholds: { | ||
// We want the 95th percentile of all HTTP request durations to be less than 40s | ||
"http_req_duration": ["p(95)<40000"], | ||
// Thresholds based on the custom metric we defined and use to track application failures | ||
"check_failure_rate": [ | ||
// Global failure rate should be less than 1% | ||
"rate<0.01", | ||
// Abort the test early if it climbs over 5% | ||
{ threshold: "rate<=0.05", abortOnFail: true }, | ||
], | ||
}, | ||
}; | ||
|
||
// Main function | ||
export default function () { | ||
let content_size = 1024 * 1024 * 256; // 256 MB | ||
let no_random_input = true; | ||
let outfile = randomIntBetween(1,500000); | ||
let url = `${PROTOCOL}://${HOSTNAME}:${PORT}/api/SyncPutBlobAsBytesReturnHttpResponse?content_size=${content_size}&no_random_input=${no_random_input}&outfile=${outfile}`; | ||
let response = http.get(url); | ||
|
||
// check() returns false if any of the specified conditions fail | ||
let checkRes = check(response, { | ||
"status is 200": (r) => r.status === 200, | ||
"content_size matches": (r) => r.json().content_size === content_size, | ||
}); | ||
|
||
// We reverse the check() result since we want to count the failures | ||
failureRate.add(!checkRes); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.