- 
                Notifications
    You must be signed in to change notification settings 
- Fork 253
Add The Growth of the Swift Server Ecosystem blog post #1171
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just added a few suggestions for your consideration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a bunch of ideas and notes, hope these help!
It felt like a bunch of the examples could be made a bit more impactful
|  | ||
| ## Running in Production | ||
|  | ||
| There have been some really awesome success stories emerge over the last few years, reinforcing the strength of Swift on the server. The award-winning Things app [explained how they migrated their backend](/blog/how-swifts-server-support-powers-things-cloud/) from Python to Swift, seeing a 4x increase in performance, whilst running 3x cheaper! | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| There have been some really awesome success stories emerge over the last few years, reinforcing the strength of Swift on the server. The award-winning Things app [explained how they migrated their backend](/blog/how-swifts-server-support-powers-things-cloud/) from Python to Swift, seeing a 4x increase in performance, whilst running 3x cheaper! | |
| Swift's impact on production deployments has been gaining momentum, and among other success stories, this year the award-winning Things app [explained how they migrated their backend](/blog/how-swifts-server-support-powers-things-cloud/) from Python to Swift, seeing a _4x increase request handling performance_, while operating at a _3x lower cost_! | 
"increase in performance" is a bit handwavy, we should use more precise wording, I suggested something, is that the right way to summarize that use case?
|  | ||
| ## Language strengths and improvements | ||
|  | ||
| Swift has grown a lot since Swift 3! The languages has seen a huge number of changes heavily adopted, and in some cases driven, by the server world. Native UTF-8 strings, `Codable`, keypaths and property wrappers all saw quick adoption by server packages. Swift Concurrency was a game changer, making it significantly easier for developers to write asynchronous code, which is especially helpful in an environment where almost everything in asynchronous! Task local values make it simple to introduce distributed tracing to applications without the need to pass contexts around everywhere. More recently, features such as package traits and macros have already started to be adopted by server libraries, to provide more performant and more efficient code to end users. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Swift has grown a lot since Swift 3! The languages has seen a huge number of changes heavily adopted, and in some cases driven, by the server world. Native UTF-8 strings, `Codable`, keypaths and property wrappers all saw quick adoption by server packages. Swift Concurrency was a game changer, making it significantly easier for developers to write asynchronous code, which is especially helpful in an environment where almost everything in asynchronous! Task local values make it simple to introduce distributed tracing to applications without the need to pass contexts around everywhere. More recently, features such as package traits and macros have already started to be adopted by server libraries, to provide more performant and more efficient code to end users. | |
| Swift has grown a lot since Swift 3! The languages has seen a huge number of changes heavily adopted, and in some cases driven, by the server world. Native UTF-8 strings, `Codable`, keypaths and property wrappers all saw quick adoption by server packages. Swift Concurrency was a game changer, making it significantly easier for developers to write asynchronous code, which is especially helpful in an environment where almost everything in asynchronous! And thanks to the Swift Evolution process, we were able to co-design language features and libraries such as task-local values and distributed tracing in such a way that it all works together efficiently and seamlessly. More recently, features such as package traits and macros have already started to be adopted by server libraries, to provide more efficient code to end users. | 
- I'd say this more strongly, we co-designed language and libraries here!
- performant seemed redundant
|  | ||
| As great as Swift is, Swift on the server is nothing without an ecosystem. Over the last decade, [Vapor](https://vapor.codes) continues to evolve and grow, newer frameworks like [Hummingbird](https://hummingbird.codes) are taking advantage of modern Swift features, and a swathe of packages have been released to support all kinds of APIs, libraries and databases. I'm always amazed at the weird and wonderful ways people are using Swift in server environments and how much of the ecosystem is driven by the community. | ||
|  | ||
| The [areweserveryet.org](https://areweswiftyyet.org/) website has a great list of different packages available, and the [Swift Package Index](https://swiftpackageindex.com/) has been instrumental in propelling the package ecosystem on Linux, with build results for every single package submitted. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- https://www.areweserveryet.org link is broken
- tbh I'd rather not link to that... It was fun for a while but I don't think it helps our message here; the package index is a far more useful resource to point people towards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The [areweserveryet.org](https://areweswiftyyet.org/) website has a great list of different packages available, and the [Swift Package Index](https://swiftpackageindex.com/) has been instrumental in propelling the package ecosystem on Linux, with build results for every single package submitted. | |
| The [Swift Package Index](https://swiftpackageindex.com/) has been instrumental in propelling the package ecosystem on Linux, with build results for every single package submitted, allowing the community to ascertain the level of support for other platforms by open source packages in real time. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case it helps it's worth remembering that people can search for linux compatible packages by adding platform:linux to the end of any search query to filter by linux compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the link - kept it in as it's another example of ecosystem and just 'all the stuff' we have but happy to discuss further
|  | ||
| The [areweserveryet.org](https://areweswiftyyet.org/) website has a great list of different packages available, and the [Swift Package Index](https://swiftpackageindex.com/) has been instrumental in propelling the package ecosystem on Linux, with build results for every single package submitted. | ||
|  | ||
| We're seeing Swift pick up more acceptance in the server world and the recent [Valkey announcement for Swift](https://valkey.io/blog/valkey-swift/) is a testament to the efforts of the community in making Swift a first-class citizen on the server. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to paint a bolder picture here... and link drop a few more projects to give an "oh wow, i didnt know that" effect:
| We're seeing Swift pick up more acceptance in the server world and the recent [Valkey announcement for Swift](https://valkey.io/blog/valkey-swift/) is a testament to the efforts of the community in making Swift a first-class citizen on the server. | |
| More and more projects are noticing the value proposition of Swift. Anything from << LINK>> Safari moving to replace its C++ use with Swift, to the Godot game engine <<LINK>> adopting Swift for its ergonomics and performance, and more recently projects like [Valkey](https://valkey.io/blog/valkey-swift/) and others also including official Swift clients, is a testament to the efforts of the community in making Swift a first-class citizen on the server and beyond. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whilst I think those are super valuable, they're not really related to the server story, more ecosystem focused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"We" is unclear in the original draft; I'd suggest either changing it to "I" or removing it entirely to make it more of a statement: "Swift has seen more acceptance in the server world"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks all! I've incorporated a lot of the feedback and tried to keep the original voice
| Thanks for the mention of SPI, it's appreciated. I wonder if there might be an opportunity to mention that the SPI itself is written in Swift using Vapor. As far as I know, it's still the largest open source Vapor app. It doesn't need to be a huge paragraph, but maybe as it gets introduced a little context like that might be good. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this! Added some comments...
|  | ||
| One of the big changes in recent years is the introduction of [`Sendable`](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency#Sendable-Types), which has eliminated many cases of data race issues. A great showcase of this is Vapor, which used to see one or two issues created a month reporting data race crashes that were impossible to reproduce and extremely hard to resolve. Since Vapor adopted `Sendable` there hasn't been **a single report** of a data race crash, which is astonishing! This just goes to show how using Swift makes it easier to write safe server applications. | ||
|  | ||
| [Foundation](https://github.com/swiftlang/swift-foundation) has also undergone a significant journey. Gone are the days of an entirely separate implementation for Linux. With Swift 6, the same Foundation code runs on Linux as on Apple platforms. This makes it far easier for developers to build on different platforms. Speaking of which, the recent cross-compilation SDKs make it super simple to build Linux binaries on macOS. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: "the Foundation library is now common across Linux and Apple platforms."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel the current text is clearer and gets the point across better
|  | ||
| ## Language strengths and improvements | ||
|  | ||
| Swift has grown a lot since Swift 3! The languages has seen a huge number of changes heavily adopted, and in some cases driven, by the server world. Native UTF-8 strings, `Codable`, keypaths and property wrappers all saw quick adoption by server packages. Swift Concurrency was a game changer, making it significantly easier for developers to write asynchronous code, which is especially helpful in an environment where almost everything in asynchronous! Task local values make it simple to introduce distributed tracing to applications without the need to pass contexts around everywhere. More recently, features such as package traits and macros have already started to be adopted by server libraries, to provide more performant and more efficient code to end users. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch for "significantly" -- it's a weasel word that doesn't add anything. Consider removing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
punctuation nits (I'm all about the Oxford comma), and a suggestion to reframe from "implementing Sendable" to "implementing data race safety checking"
|  | ||
| Swift has grown a lot since Swift 3! The language has seen a huge number of changes heavily adopted, and in some cases driven, by the server world. Native UTF-8 strings, `Codable`, keypaths and property wrappers all saw quick adoption by server packages. Swift Concurrency has been a game changer, making it significantly easier for developers to write asynchronous code, which is especially helpful in an environment where almost everything is asynchronous! Task local values make it simple to introduce distributed tracing to applications without the need to pass contexts around everywhere. More recently, features such as package traits, build plugins and macros have already started to be adopted by server libraries, to provide more performant and efficient code to end users. | ||
|  | ||
| One of the big changes in recent years is the introduction of [`Sendable`](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency#Sendable-Types), which has eliminated many cases of data race issues. A great showcase of this is Vapor, which used to see one or two issues created a month reporting data race crashes that were impossible to reproduce and extremely hard to resolve. Since Vapor adopted `Sendable` there hasn't been **a single report** of a data race crash! This just goes to show how using Swift makes it easier to write safe server applications. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might be doing a disservice by calling this adopting Sendable, as opposed to "adopting strict concurrency checking". It started with Sendable, but IMO and hindsight, focusing on Sendable up front sent a lot of people down a rough path. Perhaps rather than focusing on Sendable types here, link and touch on enabling data-race safety checking, referencing the article https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/enabledataracesafety
Co-authored-by: Joseph Heck <[email protected]>
| Thanks for sharing this post, @0xTim! Merging now. | 
Add a blog post covering 10 years of Swift on the server and the server ecosystem