Commit Graph

47 Commits

Author SHA1 Message Date
Sébastien Stormacq 0305cb31b8 Add scripts to measure cold start performance (#604)
I added two shell scripts under `scripts/lambda-performance` to help
measure Lambda cold and warm start time.

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-11-19 20:36:51 +01:00
Sébastien Stormacq 85bd29e4de Makes performance script run on macOS (#603)
By default, the script started the MockServer on port 7000, which is
used by AirPlay on macOS.
This caused conflicts.

I also made a minor change on the logging to avoir reporting an error
when the server closes the connection.
2025-11-16 21:02:15 +01:00
Sébastien Stormacq e58d89148c Replace standard documents and processes with AWS ones (#574)
- Adjust notice, security reporting, code of conduct, contribution
process to the standard AWS documents
- Adjust GitHub issue templates to AWS standard ones.
- Adjust the license header in all source files

---------

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-10-21 23:27:30 +02:00
Sébastien Stormacq dee635267b change references from /swift-server to /awslabs (#591)
Change Examples, README, and doc to refer to https://github.org/awslabs
instead of https://github.org/swift-server

---------

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-10-17 16:46:58 +02:00
Sébastien Stormacq a1ab8df708 Update toolchain and doc for 6.2 (#564)
In preparation for the 2.0.0 GA release,

- Update `.swift-version`, `Package.swift` and all examples'
`package.swift` to Swift 6.2
- Update all references to `2.0.0-beta.3` to `2.0.0`. This includes the
doc and readme, but also the dependencies in the examples
`Package.swift`. This will temporary break the build of the examples,
until we tag v2.0.0. Note the CI will not be affected as its consumes
the local version of the library
- [CI] Use Swift-6.2-noble for all testing tasks
- Reinstate the script to generate the contributors list and update the
list
2025-09-23 21:12:33 +02:00
Sébastien Stormacq 11bea7b2ee Performance Test the invocation loop (fix #377) (#542)
re-implement MAX_INVOCATIONS and fix shell script 
Fix https://github.com/swift-server/swift-aws-lambda-runtime/issues/377

### Motivation:

In v1, there was a script measuring the performance of the invocation
loop.
Re-instate this script to allow users and developers to measure the
performance impact of their changes.

### Modifications:

I re-implemented MAX_INVOCATIONS, to avoid the client looping against
the Mock Server. But this time, MAX_INVOCATIONS is handled on the
server, not on the client.

I slightly modified the script to work with v2 and the new MockServer.

### Result:

The script works.

This PR has a dependency on
https://github.com/swift-server/swift-aws-lambda-runtime/issues/465
2025-08-05 08:39:20 +02:00
Sébastien Stormacq e6ba07fd06 [example] Add example for Swift Service Lifecycle (#522)
Now that task cancellation works, re publishing this PR with a new
example for Swift Service Lifecycle
2025-07-30 06:40:55 +04:00
Sébastien Stormacq 36dadf9c26 [doc] fix header level warnings from CI soundness/doc scripts (#537)
```
note: The majority of content should be under level-3 headers under the "Overview" section
  --> Deployment.md:22:1-22:17
20 |   * [Third-party tools](#third-party-tools)
21 |
22 + ## Prerequisites
   | ╰─suggestion: Change the title to "Overview"
23 |
24 | 1. Your AWS Account

```

and many others.

Action: I lowered all titles one level down.
2025-07-25 20:13:07 +04:00
Sébastien Stormacq 9287d56e60 [core] Implement Lambda streaming with custom HTTP headers (#521)
Fix https://github.com/swift-server/swift-aws-lambda-runtime/issues/520
2025-07-24 15:03:29 +04:00
Sébastien Stormacq 935ea0fe91 Remove dependency on XCTest (#516)
Remove dependency on XCTest

### Motivation:

As 6.1 does not include XCTest anymore, finish the migration to Swift
testing

### Modifications:

Replace XCTest by Swift Testing in two files

### Result:

`swift test` works on 6.1.2

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-28 13:09:44 +02:00
Sébastien Stormacq 71d49b049e [plugin] support for resources packaging on ubuntu (#467)
When including resources in the package and packaging on Ubuntu,
`FileManager` throws a FilePermission error. The docker daemon runs as
root and files to be copied are owned by `root` while the archiver runs
as the current user (`ubuntu` on EC2 Ubuntu). The `FileManager` manages
to copy the files but throws an error after the copy. We suspect the
`FileManager` to perform some kind of operation after the copy and it
fails because of the `root` permission of the files.

See
https://github.com/swift-server/swift-aws-lambda-runtime/issues/449#issuecomment-2595978246
for a description of the problem.

This PR contains code to reproduce the problem, a very simple
workaround, and an integration test.
The workaround consists of 
- trapping all errors
- verify if the error is the permission error (Code = 513)
- verify if the files have been copied or not 
- if the two above conditions are met, ignore the error, otherwise
re-throw it

I would rather prefer a solution that solves the root cause rather than
just ignoring the error.
We're still investigating the root cause (see [this
thread](https://forums.swift.org/t/filemanager-copyitem-on-linux-fails-after-copying-the-files/77282)
on the Swift Forum and this issue on Swift Foundation
https://github.com/swiftlang/swift-foundation/issues/1125
2025-01-21 08:06:51 +01:00
Sébastien Stormacq 04b01da9fe move integration test to .github (#443)
_[One line description of your change]_

### Motivation:

_[Explain here the context, and why you're making that change. What is
the problem you're trying to solve.]_

### Modifications:

_[Describe the modifications you've done.]_

### Result:

_[After your change, what will change.]_
2024-12-22 15:17:44 +01:00
Sébastien Stormacq 64a4d829f0 Fix CI (#429)
* disable yaml linter

* add semver label check

* re-enable soundness checks (shell, python, and yaml)

* disable checks on docc shell command

* fix errors
2024-11-26 18:32:24 +01:00
Sébastien Stormacq 65061a638c Remove docker compose files + add GH action to compile examples during CI (#397)
* add GH action to compile examples on PR

* remove old docker infrastructure


---------


Co-authored-by: Fabian Fett <fabianfett@apple.com>
2024-10-10 11:16:12 +02:00
Franz Busch ab8166a39d [CI] Add GHA CI and release flow (#340)
Co-authored-by: Fabian Fett <fabianfett@apple.com>
Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
2024-08-26 16:36:07 +02:00
Sébastien Stormacq f42dda3fca Update soundness.sh to support 2024 and 2025 (#335) 2024-08-05 18:01:17 +02:00
Sébastien Stormacq 5d300b2e1b ignore swift files part of docc (#307) 2023-09-11 09:30:19 -07:00
tomer doron c915322eca API Refactoring (#273)
motivation: define stable API in preperation 1.0 release

changes:
* require swift 5.7, remove redundant backwards compatibility code
* make LambdaHandler, EventLoopLambdaHandler, and ByteBufferLambdaHandler disjointed protocols to reduce API surface area
* create coding wrappers for LambdaHandler and EventLoopLambdaHandler to provide bridge to ByteBufferLambdaHandler
* reuse output ByteBuffer to reduce allocations
* add new SimpleLambdaHandler with no-op initializer for simple lambda use cases
* update callsites and tests
* update examples

Co-authored-by: Yim Lee <yim_lee@apple.com>
Co-authored-by: Fabian Fett <fabianfett@apple.com>
2022-11-09 10:08:36 -08:00
Yim Lee 98a23b64bb DocC setup (#270) 2022-08-21 20:29:08 -07:00
YR Chen cb340de265 Fix performance test script (#264) 2022-06-06 09:39:40 -07:00
tomer doron 81f8d27365 packaging plugin (#254)
motivation: add an easy wasy for lambda users to package their lambda and upload it to AWS

changes:
* add SwiftPM plugin to package the lambda as zipfile, with the verb "archive"
* use docker to build and package the lambda(s) on macOS and non-amazonlinux
* build directly on when on amazonlinux, zip correctly

Co-authored-by: Yim Lee <yim_lee@apple.com>
Co-authored-by: Fabian Fett <fabianfett@apple.com>
2022-06-01 09:41:05 -07:00
Fabian Fett f6c7c5a852 Add script to check for API breaks (#258)
Co-authored-by: tomer doron <tomer@apple.com>
2022-04-15 10:36:12 -07:00
Stefan Nienhuis c1f694f35a Add default value for traceID header (#246)
* Add default value for traceID header
* Implement Invocation traceID test
2022-02-19 14:16:51 -08:00
YR Chen 39b34a159b Modernize app example (#231)
Since we already required Swift 5.5 for Concurrency (Xcode 13), it's natural to update the demo app to reflect latest SwiftUI changes, which makes the code neater and more expressive.
2021-12-06 11:30:50 +01:00
tomer doron b757de0241 Update and add examples to new APIs (#228)
* take advantage of @main where possible
* move the top level Sample code to the examples subdirectory
* extract a few examples form the "LambdaFunctions" directory (which is really a deployment demo) and move them to the top level Examples directory
*  rename "LambdaFunctions" examples as "Deployments" to make their intent clearer
* add a sample that demonstrates how to test a lambda now that SwiftPM can test executables directly
* update the test-sample docker setup to build & test th new samples
* fix a few typos and In/Out typealias left overs
* remove LinuxMain since its no longer required
2021-09-25 10:30:04 +02:00
Fabian Fett ab13e51984 Performance Improvements (#199)
Modifications:
- Replace `HTTPHandler` with `NIOHTTPClientResponseAggregator`, to fix a CoW issue. This increases performance.
- Ensure that we only use one `EventLoop` in tests.
- Use `syncOperations` to setup the `HTTPClient`.
2021-04-14 00:21:38 +02:00
tomer doron 9166653bd8 update code of conduct (#190)
motivation: align with swift project coc update

changes: update coc to the version used by the swift project (contributor-covenant.org  1.4)

Update 0226-package-manager-target-based-dep-resolution.md

Co-authored-by: Konrad `ktoso` Malawski <ktoso@apple.com>
2021-03-05 12:16:07 +09:00
Fabian Fett bfdeb75e32 Use welcoming language (#184) 2021-01-21 21:05:43 -08:00
tomer doron 64ee5a215c small fixes to the perf script (#78)
motivation: keep script up to date

changes:
* use 5.3 nightly
* better support for perf symlink as the location is a moving target
* info about cold/warm start
2020-05-12 16:04:30 -07:00
tom doron b5f18dad4b move examples into a subdirectory
motivation: easier to find and reason about

changes: move exmaples from a seperate repo into a subdirectory
2020-05-07 08:56:31 -07:00
tom doron d5368bbe25 moving examples into a subdirectory 2020-05-06 12:19:03 -07:00
tachyonics d3c72e93e6 Add a SAM template for deploying the lambdas to AWS. (#2)
motivation: demonstrate how to deploy with SAM

changes:
* Add a SAM template for deploying the lambdas to AWS. 
* Updated README with instructions on how to do this.
2020-04-06 09:31:43 -07:00
tomer doron 40d05992f7 breakdown examples intro separate targets (#1)
motivation: easier to reason about examples

changes:
* move each example to its own target
* update deployment script to prompt for desired target when multiple targets exist
* add code comments on what the example is about
* add feature-reach example (CurrencyExchange) to help testing use of Foundation features that require curl and libxml
2020-04-02 11:01:27 -07:00
tomer doron 1685d891b0 update perf script (#51)
motivation: beter perf script

changes:
* adjust to latest version of perf
* higher frequency sampling
* more debug symbols
2020-03-27 15:32:14 -07:00
tom doron e1ee4ea0dd initial commit 2020-03-25 16:08:42 -07:00
tomer doron c2673d4634 update contributors list (#43)
motivation: keep contributors list up to date

changes:
* add mailmap
* run contributors script
2020-03-17 18:25:48 -07:00
tomer doron b61aab012e rename project to SwiftAWSLambdaRuntime (#38)
motivation: unique, accurate name

changes:
* rename project to SwiftAWSLambdaRuntime
* rename main module to AWSLambdaRuntime
* rename / simplify sample module names
* adjust readme and scripts
2020-03-13 14:48:25 -07:00
tomer doron 88f3b504f4 swift 5.2 (#37)
motivation: amazon linux support will land in 5.2

changes:
* remove inline as its default in 5.2
* remove linux test and lean on --enable-test-discovery
* adjust package syntax
* format code to match 5.2
2020-03-13 12:54:12 -07:00
tomer doron 9d15930563 improve linux perf script (#34)
motivation: more details from perf / flamegrpah

changes:
* run docker in privileged mode and turn off kptr_restrict
* fix typo
2020-03-12 10:38:16 -07:00
tomer doron 2e04511741 move config, lifecycle, context to separate files (#32)
motivation: easier code navigation

changes: move config, lifecycle, context to separate source files
2020-03-11 12:01:18 -07:00
tomer doron b8a6466577 add docker support (#15)
motivation: enable CI

changes: add docker files support for ubuntu 16.04 and 18.04 and swift 5.0 and 5.1

note that eventyally this will need to move to AL2 docker images, but we dont have official ones yet
2020-03-06 18:43:16 -08:00
tomer doron 95cf94e4ad add script to help setup performance measuring in linux (#12)
motivation: performance tuning

changes: add script with setup code and example for running strace and perf
2020-03-06 15:23:03 -08:00
tomer doron 3fc1b1ae5a Scale test iterations independently (#6) 2020-03-05 13:51:30 -08:00
Tom Doron 209906d390 performance improvments (#17)
motivation: better performance

changes:
* simply url configuration to ip and port so we can reoslve the socket add ress faster
* skip happy eyeballs
* limit eventloop group to 1 thread
* remove use of UUID and URL
* fix backtrace url
2020-03-04 13:54:55 -08:00
Tom Doron c3d4ad5a39 performance tests (#16)
motivation: benchmark for comparison of warm/cold runs

changes:
* refactor configuration
* add mock server that can be used by perf tests
* add simple perf test script
* change redundant classes to structs, make remaining classes final
* make offloading opt-in
* safer locking
* fix format
2020-03-04 11:01:15 -08:00
Tom Doron c31ee33105 refactor (#12)
motivation: make code simpler to reason about, better use of swift-nio

changes:
* remove main loop on global queue + wait, replace with recursion
* make better use of EvenLoopFuture, instead of result types to signal errors
* inject lifecycleId so we can share offloading queue
* improve logging
* adjust and improve tests
* update sanity and generate linux tests script to work better with dates and swiftformat
2019-09-16 10:05:02 +01:00
tomer doron 93c9cfdf63 initial commit 2018-11-13 17:48:44 -08:00