Skip to content

Commit d69cb20

Browse files
RobinBateman8080xTimFranzBusch
authored
Overhaul SOS introduction (#524)
* extra space * Updated overview and why SoS * Slight language change to push again. * Test 2 push * Update documentation/server/index.md Co-authored-by: Tim Condon <[email protected]> * Update documentation/server/index.md Co-authored-by: Tim Condon <[email protected]> * Update documentation/server/index.md Co-authored-by: Tim Condon <[email protected]> * Update index.md Made suggested changes per workgroup feedback. * Added "Sendable" attribute info * Added other language comparison * Removed Prime Video reference * Removed JIT no runtime line Co-authored-by: Franz Busch <[email protected]> * corrected language C++/Object C Co-authored-by: Franz Busch <[email protected]> * changed verb usage Co-authored-by: Franz Busch <[email protected]> * Removed cost comparison Co-authored-by: Franz Busch <[email protected]> * Removed Sendable caveat Co-authored-by: Franz Busch <[email protected]> * removed Apple context Co-authored-by: Franz Busch <[email protected]> * removed Apple reference Co-authored-by: Franz Busch <[email protected]> * removed basics help reference Co-authored-by: Franz Busch <[email protected]> --------- Co-authored-by: Tim Condon <[email protected]> Co-authored-by: Franz Busch <[email protected]>
1 parent e436d0e commit d69cb20

File tree

1 file changed

+53
-28
lines changed

1 file changed

+53
-28
lines changed

documentation/server/index.md

+53-28
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,64 @@ layout: page
77
title: Swift on Server
88
---
99

10-
Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.
10+
## Overview
11+
[**Swift**](https://www.swift.org) is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns. Originally developed by Apple for building iOS, macOS, watchOS, and tvOS applications, Swift’s project goal is to create the best available language for uses ranging from systems programming to mobile and desktop apps, scaling up to highly distributed cloud services. Swift’s rich ecosystem of libraries allows services to be developed and deployed on Linux or macOS. Most importantly, Swift is designed to make writing and maintaining correct programs simple for developers.
1112

12-
The goal of the Swift project is to create the best available language for uses ranging from systems programming, to mobile and desktop apps, scaling up to cloud services.
13-
Most importantly, Swift is designed to make writing and maintaining correct programs easier for the developer.
13+
**Swift on Server** refers to the ability to use the Swift programming language for server-side development. To deploy Swift applications on the server, developers can make use of web frameworks such as [Vapor](https://vapor.codes/) and [Hummingbird](https://swiftpackageindex.com/hummingbird-project/hummingbird) which provide a variety of tools and libraries to streamline the development process. These frameworks handle important aspects like routing, database integration, and request handling, allowing developers to focus on building the business logic of their applications.
14+
15+
Various companies and organizations have adopted Vapor and Hummingbird to power their production services.
1416

1517
## Why Swift on Server?
1618

17-
In addition to the characteristics of Swift that make it an excellent general-purpose programming language,
18-
it also has unique characteristics that make it specifically suitable for Server applications
19+
Swift on Server provides developers with a modern, safe, and efficient option for writing server-side code. Swift combines the simplicity and readability of a high-level language with the performance and safety features of a compiled language, allowing developers to leverage their existing Swift skills to build complete end-to-end solutions using a single programming language.
20+
21+
In addition to the characteristics of Swift that make it an excellent general-purpose programming language, it also has unique characteristics that make it specifically suitable for server applications due to its:
22+
23+
- Performance
24+
- Quick start-up time
25+
- Expressiveness and safety
26+
- Supported ecosystem
27+
28+
### Performance
29+
Swift offers fast performance and a low memory footprint. Instead of tracing garbage collection, it uses [Automatic Reference Counting (ARC)](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/automaticreferencecounting/) and ownership features, which allows precise control over resources. Swift’s use of ARC and its lack of just-in-time (JIT) compilation provides an edge in the cloud services space.
30+
31+
While tracing garbage collection technologies have improved, they still compete with the application for resources, triggering non-deterministic performance. Debugging non-deterministic performance and language-induced non-deterministic performance can confuse and mask application-level performance issues that can otherwise be addressed.
32+
33+
One of the main goals of a modern cloud platform is to maximize resource utilization by efficiently packing services into a single machine. Cloud services built with Swift have a small memory footprint (measured in MB), especially compared to other popular server languages with automatic memory management. Services built with Swift are also CPU-efficient, given the language’s focus on performance.
34+
35+
While Java, PHP, Python, and JavaScript have their strengths and use cases, Swift offers several advantages over other programming languages. For example, Swift’s performance is comparable to languages like C and C++, making it well-suited for building high-performance server applications. Thanks to the progressive and efficient design of the language, Swift server-side applications can handle large-scale workloads with high performance and low resource consumption.
36+
37+
These characteristics make Swift ideal for use in modern cloud platforms when maximizing resource utilization is needed.
38+
39+
### Quick start-up time
40+
Swift-based applications quickly start since there are almost no warm-up operations, making Swift an ideal fit for cloud services, which are often rescheduled onto new virtual machines (VMs) or containers to address platform formation changes. Other considerations include:
41+
42+
- Quick boot times make Swift ideal for serverless applications such as [Google Cloud Functions](https://cloud.google.com/functions#) or [AWS Lambda](https://aws.amazon.com/lambda/) with negligible cold start times. Additionally, the quick start-up time and low memory advantages make Swift a good choice for microservices that scale in the cloud.
43+
- Using Swift helps streamline continuous delivery pipelines, incurring less wait time for new versions of the service fleet to go online.
44+
- Swift allows you to rapidly respond to the need to scale up where services can dynamically adjust their number of instances.
45+
46+
47+
### Expressive and safe
48+
Swift enforces type-safety, optionals, and memory safety features that help prevent common programming errors and improve code reliability. Swift on Server benefits from these robust language features, making it less prone to crashes and security vulnerabilities.
49+
50+
Swift provides [built-in support for concurrency](https://developer.apple.com/documentation/swift/concurrency/), allowing developers to write scalable and responsive server applications. Swift’s concurrency model makes it suitable for developing highly concurrent server applications.
51+
52+
Swift's concurrency model introduces new language features and constructs to make it easier and safer to write concurrent code. The **Sendable** attribute is used to annotate types that are known to be safe to pass between tasks. By designating a type as Sendable, Swift ensures that it is safe to share and access that type across multiple concurrent tasks without causing data corruption or synchronization issues. This helps to prevent common concurrency problems, such as race conditions or access to stale data.
53+
54+
The Sendable attribute is particularly useful in the context of Swift on the server, where concurrency and parallelism are frequently utilized. It provides a way to declare and enforce the safety of data accessed by multiple tasks simultaneously, helping to avoid data corruption and maintain data integrity.
1955

20-
### Small footprint
21-
One of the main goals of a modern cloud platform is to maximize resource utilization by efficiently packing services into a single machine.
22-
Cloud services built with Swift have a small memory footprint (measured in MB)--especially when compared to other popular server languages with automatic memory management.
23-
Services built with Swift are also CPU-efficient, given the language’s focus on performance.
56+
### Supported ecosystem
57+
The Swift ecosystem contains many useful libraries and tools specifically designed for server-side development.
2458

25-
### Quick startup time
26-
Swift-based applications start quickly since there are almost no warm up operations.
27-
This makes Swift a great fit for cloud services, which are often re-scheduled onto new VMs or containers to address platform formation changes.
28-
Using Swift also helps streamline continuous delivery pipelines, since you incur less wait time for new versions of the service fleet to come online.
29-
Finally, quick boot times make Swift a perfect fit for serverless applications such as Cloud Functions or Lambda with negligible cold start times.
59+
Overall, Swift on Server opens up new opportunities for developers to build fast, scalable, and secure backend services. Swift's combination of performance, readability, interoperability, safety, and modern language features make it a compelling choice for many developers.
3060

31-
### Deterministic performance
32-
Swift’s use of ARC (instead of tracing garbage collection) and its lack of JIT gives it an important edge in the cloud services space.
33-
While tracing garbage collection technologies have vastly improved in the last few years, they still compete with the application for resources which triggers non-deterministic performance.
34-
The absence of JIT means no runtime optimization or de-optimization.
35-
It’s challenging to debug non-deterministic performance, and language-induced non-deterministic performance can both confuse and mask application-level performance issues that could otherwise be addressed.
3661

3762
## Development guides
3863

39-
The Swift Server Workgroup and Swift on Server community have developed a number of guides for using Swift on the server.
40-
They are designed to help teams and individuals running Swift Server applications on Linux and to provide orientation for those who want to start with such development.
64+
The Swift Server Workgroup and Swift on Server community have developed several guides for using Swift on the server.
65+
They are designed to help teams and individuals running server-side Swift applications on Linux, including orientation for those who want to start developing with Swift.
4166

42-
They focus on how to compile, test, deploy and debug such application and provides tips in those areas.
67+
The following guides focus on how to compile, test, deploy, and debug applications and provide tips in those areas:
4368

4469
- [Setup and code editing](/documentation/server/guides/setup-and-ide-alternatives.html)
4570
- [Building](/documentation/server/guides/building.html)
@@ -51,20 +76,20 @@ They focus on how to compile, test, deploy and debug such application and provid
5176
- [Deployment](/documentation/server/guides/deployment.html)
5277
- [Packaging](/documentation/server/guides/packaging.html)
5378

54-
Additionally, there are specific guides for library developers:
79+
Additionally, specific guides exist for library developers:
5580

5681
* [Log Levels](/documentation/server/guides/libraries/log-levels.html)
5782
* [Adopting Swift Concurrency](/documentation/server/guides/libraries/concurrency-adoption-guidelines.html)
5883

59-
_These guides are community effort, and all are invited to share their tips and know-how by submitting pull requests to the [Swift.org site](https://github.com/apple/swift-org-website)_.
84+
_These guides are a community effort. Anyone is invited to share their tips and know-how by submitting pull requests to the [Swift.org site](https://github.com/apple/swift-org-website)_.
6085

6186
## Swift Server Workgroup
6287

6388
The Swift Server workgroup is a steering team that promotes the use of Swift for developing and deploying server applications.
64-
The Swift Server workgroup:
89+
The workgroup:
6590

66-
* Defines and prioritize efforts that address the needs of the Swift server community
67-
* Defines and run an incubation process for these efforts to reduce duplication of effort, increase compatibility and promote best practices
68-
* Channels feedback for Swift language features needed by the server development community to the Swift Core Team
91+
* Defines and prioritizes efforts that address the needs of the Swift server community.
92+
* Defines and runs an incubation process for these efforts to reduce duplication of effort, increase compatibility, and promote best practices.
93+
* Channels feedback for Swift language features needed by the server development community to the Swift Core Team.
6994

7095
Read more about the workgroup and server incubator it runs [here](/sswg "Swift Server Workgroup").

0 commit comments

Comments
 (0)