Skip to content

Commit

Permalink
Merge branch 'dev' into RandomHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
maliming committed Oct 23, 2024
2 parents 6ae2641 + 9ce22a9 commit f33eae9
Show file tree
Hide file tree
Showing 295 changed files with 3,266 additions and 2,930 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/auto-pr.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Merge branch dev with prerel-9.0
name: Merge branch dev with rel-9.0
on:
push:
branches:
- prerel-9.0
- rel-9.0
permissions:
contents: read

jobs:
merge-dev-with-prerel-9-0:
merge-dev-with-rel-9-0:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
Expand All @@ -18,19 +18,19 @@ jobs:
ref: dev
- name: Reset promotion branch
run: |
git fetch origin prerel-9.0:prerel-9.0
git reset --hard prerel-9.0
git fetch origin rel-9.0:rel-9.0
git reset --hard rel-9.0
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
branch: auto-merge/prerel-9-0/${{github.run_number}}
title: Merge branch dev with prerel-9.0
body: This PR generated automatically to merge dev with prerel-9.0. Please review the changed files before merging to prevent any errors that may occur.
branch: auto-merge/rel-9-0/${{github.run_number}}
title: Merge branch dev with rel-9.0
body: This PR generated automatically to merge dev with rel-9.0. Please review the changed files before merging to prevent any errors that may occur.
reviewers: maliming
token: ${{ github.token }}
- name: Merge Pull Request
env:
GH_TOKEN: ${{ secrets.BOT_SECRET }}
run: |
gh pr review auto-merge/prerel-9-0/${{github.run_number}} --approve
gh pr merge auto-merge/prerel-9-0/${{github.run_number}} --merge --auto --delete-branch
gh pr review auto-merge/rel-9-0/${{github.run_number}} --approve
gh pr merge auto-merge/rel-9-0/${{github.run_number}} --merge --auto --delete-branch
3 changes: 2 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PackageVersion Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="3.0.0" />
<PackageVersion Include="aliyun-net-sdk-sts" Version="3.1.2" />
<PackageVersion Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
<PackageVersion Include="AsyncKeyedLock" Version="7.0.1" />
<PackageVersion Include="AsyncKeyedLock" Version="7.0.2" />
<PackageVersion Include="Autofac" Version="8.1.0" />
<PackageVersion Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageVersion Include="Autofac.Extras.DynamicProxy" Version="7.1.0" />
Expand Down Expand Up @@ -166,6 +166,7 @@
<PackageVersion Include="System.Text.Encoding.CodePages" Version="9.0.0-rc.2.24473.5" />
<PackageVersion Include="System.Text.Encodings.Web" Version="9.0.0-rc.2.24473.5" />
<PackageVersion Include="System.Text.Json" Version="9.0.0-rc.2.24473.5" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.1.0" />
<PackageVersion Include="TimeZoneConverter" Version="6.1.0" />
<PackageVersion Include="Unidecode.NET" Version="2.1.0" />
Expand Down
4 changes: 2 additions & 2 deletions common.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>9.0.0-preview</Version>
<LeptonXVersion>4.0.0-preview</LeptonXVersion>
<Version>9.1.0-preview</Version>
<LeptonXVersion>4.1.0-preview</LeptonXVersion>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
<PackageIconUrl>https://abp.io/assets/abp_nupkg.png</PackageIconUrl>
<PackageProjectUrl>https://abp.io/</PackageProjectUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,7 @@ After making all our changes, we can run the `AspirationalAbp.AppHost` project.
## Conclusion

Combining .NET Aspire with the ABP framework creates a powerful setup for building robust, observable, and feature-rich applications. By integrating Aspire's observability and cloud capabilities with ABP's approach of focusing on your business without repeating yourself, you can develop feature-rich, scalable applications with enhanced monitoring and seamless cloud integration. This guide provides a clear path to set up and configure these technologies, ensuring your applications are well-structured, maintainable, and ready for modern cloud environments.

## See Also

* [.NET Aspire vs ABP Studio: Side by Side](https://abp.io/community/articles/.net-aspire-vs-abp-studio-side-by-side-t1c73d1l)
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# When to Use Cookies, When to Use Local Storage?

![cover](cover.png)



## Cookies vs Local Storage

When you want to save client-side data on browsers, you can use `Cookies` or `Local Storage` of the browser. While these methods look similar, they have different behaviors. You need to decide based on the specific use-case, security concerns and the data size being stored. I'll clarify the differences between these methods.



## When to use Cookies 🍪?

1. **Server Communication (e.g: Authentication Tokens):** Cookies are ideal when you need to send data automatically with HTTP requests to the server, such as authentication tokens (JWTs) or session IDs. Cookies can be configured to be sent only to specific domains or paths, making them useful for session management.
2. **Cross-Domain Communication:** Cookies can be shared across subdomains, which is useful when working with multiple subdomains under the same parent domain for microservice architecture.
3. **Expiration Control:** Cookies come with built-in expiration times. You don’t need to manually remove them after a certain period that should expire.
4. **Security:** Cookies can be marked as `HttpOnly` which makes them accessible **only via the server**, not via JavaScript! Also, when you set a cookie attribute, `Secure` it can be sent only over HTTPS, which forces enhanced security for sensitive data.


### Considerations for Cookies

- **Size Limitation:** Cookies are generally limited to around 4KB of data.
- **Security Risks:** Cookies are susceptible to cross-site scripting (XSS) attacks unless marked `HttpOnly`.


---


## When to use Local Storage🗄️?

1. **Client-Side Data Storage:** Local storage is ideal for storing large amounts of data (up to 5–10 MB) that doesn’t need to be sent to the server with every request. For example; *user preferences*, *settings*, or *cached data*.
2. **Persistence:** Data in local storage persists even after the browser is restarted. This behavior makes it useful for long-term storage needs.
3. **No Automatic Server Transmission:** Local storage data is never automatically sent to the server, which can be a security advantage if you don’t want certain data to be exposed to the server or included in the requests.


### Considerations for Local Storage

- **Security Risks:** Local storage is accessible via JavaScript, making it vulnerable to XSS attacks. Sensitive data should not be stored in local storage unless adequately encrypted.

- **No Expiration Mechanism:** Local storage does not have a built-in expiration mechanism. You must manually remove the data when it’s no longer needed.


---



## Summary

### Use Cookies

- For data that needs to be sent to the server with HTTP requests, particularly for session management or authentication purposes.

### Use Local Storage

- For storing large amounts of client-side data that doesn’t need to be automatically sent to the server and for data that should persist across browser sessions.



In many cases, you might use both cookies and local storage, depending on the specific requirements of different parts of your application. There are also other places where you can store the client-side data. You can check out [this article](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Client-side_storage) for more information.


Happy coding 🧑🏽‍💻
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# .NET 9 Performance Improvements Summary

With every release, .NET becomes faster & faster! You get these improvements for free by just updating your project to the latest .NET!

![Cover Image](cover.png)

It’s very interesting that **20% of these improvements** are implemented by **open-source volunteers** rather than Microsoft employees. These improvements mostly focus on cloud-native and high-throughput applications. I’ll briefly list them below.

![From Microsoft Blog Post](cited-from-microsoft-blog-post.png)



## 1. Dynamic PGO with JIT Compiler

* ### What is dynamic PGO?
With “Profile Guided Optimization” the compiler optimizes the code, based on the flow and the way the code executes. It is predicated on the idea that every potential behavior of the code will always transpire.

* ### What’s Improved?
The tiered compilation, inlining, and dynamic PGO are three ways that .NET 9 optimizes the JIT compiler. This enhances runtime performance and speeds up the time for apps to launch.

* ### Performance Gains
CPU use is lower during execution; therefore, **startup times are about 15% faster**.

* ### As a Developer
Faster, smoother deployments with reduced warm-up times... These enhancements reduce latency for applications with complex workflows, particularly in microservices and high-throughput environments.

* ### How to activate Dynamic PGO?
Add the following to your `csproj` file, or if you have several `csproj` files, you can add it once in `Directory.Build.props` file. Check out [this link](https://learn.microsoft.com/en-us/dotnet/core/runtime-config/compilation#profile-guided-optimization) to understand PGO.

```xml
<PropertyGroup>
<TieredPGO>true</TieredPGO>
</PropertyGroup>
```



## 2. Library Improvements

* ### What’s Improved?

LINQ and JSON serialization, collections and libraries are significantly improved with .NET 9.

* ### Performance Gains

**JSON serialization** performance **increases by about 35%**. This helps with heavy data parsing and API requests. Less memory is allocated to `Span` operations as well, and LINQ techniques such as `Where` and `Select` are now faster.

* ### As a Developer

This means that apps will be faster, especially those that handle data primarily in JSON or manipulate data with LINQ.



## 3. ASP.NET Core

* ### What’s Improved?
Kestrel server has undergone significant modifications, mostly in processing the HTTP/2 and HTTP/3 protocols.

* ### Performance Gains
Now, **Kestrel handles requests up to 20% faster** and **has a 25% reduction in average latency**. Improved connection management and SSL processing also result in overall efficiency gains.

* ### As a Developer
These modifications result in less resource use, quicker response times for web applications, and more seamless scaling in high-traffic situations.



## 4. Garbage Collection & Memory Management

* ### What’s Improved?
NET 9’s garbage collection (GC) is more effective, especially for apps with high allocation rates.

* ### Performance Gains
Applications experience smoother **garbage collection cycles with 8–12% less memory overhead**, which lowers latency and delays.

* ### As a Developer
The performance will be more reliable and predictable for developers as there will be fewer memory-related bottlenecks, particularly in applications that involve frequent object allocations.



## 5. Native AOT Compilation

* ### What’s Improved?
Native AOT (Ahead-of-Time) compilation is now more efficient by lowering memory footprint and cold-start times. This leads to better support for cloud-native applications.

* ### Performance Gains
Native AOT apps now have faster cold launches and use **30–40% less memory**. This improvement focuses on containerized applications.

---



**References:**

* [Microsoft .NET blog post](https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-9/).
* [What’s new in the .NET 9 runtime?](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/runtime#performance-improvements)

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f33eae9

Please sign in to comment.