Skip to content

Commit

Permalink
Merge pull request #256 from AdobeDocs/app-server-branding
Browse files Browse the repository at this point in the history
Rebranded app server
  • Loading branch information
jeff-matthews authored Apr 8, 2024
2 parents 4d92a42 + 8ac719f commit c8f9b78
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .remarkrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const remarkConfig = {
"https://www.php.net",
"https://cardinalcommerce.com/",
"https://www.cyberciti.biz",
"https://eat.magento.com"
"https://eat.magento.com",
"https://developer.ups.com"
],
skipOffline: "true"
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/navigation/sections/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ module.exports = [
path: "/development/components/",
pages: [
{
title: "Application Server compatibility",
title: "GraphQL Application Server compatibility",
path: "/development/components/app-server/",
},
{
Expand Down
24 changes: 12 additions & 12 deletions src/pages/development/components/app-server.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Application Server | Commerce PHP Extensions
description: Learn about the Application Server architecture and how to ensure compatibility with custom extensions.
title: GraphQL Application Server | Commerce PHP Extensions
description: Learn about GraphQL Application Server architecture and how to ensure compatibility with custom extensions.
keywords:
- Extensions
edition: ee
Expand All @@ -10,17 +10,17 @@ edition: ee

Available in [2.4.7](https://experienceleague.adobe.com/en/docs/commerce-operations/release/notes/adobe-commerce/2-4-7) only.

# Application Server for GraphQL APIs
# GraphQL Application Server

The [Application Server for GraphQL APIs](https://experienceleague.adobe.com/en/docs/commerce-operations/performance-best-practices/concepts/application-server) enables Adobe Commerce to maintain state among GraphQL API requests. The Application Server, which is built on the Open Swoole extension, operates as a process with worker threads that handle request processing. By preserving a bootstrapped application state among GraphQL API requests, the Application Server enhances request handling and overall product performance. As a result, GraphQL request response time can be reduced by up to 30%.
The [GraphQL Application Server](https://experienceleague.adobe.com/en/docs/commerce-operations/performance-best-practices/concepts/application-server) enables Adobe Commerce to maintain state among GraphQL API requests. GraphQL Application Server, which is built on the Open Swoole extension, operates as a process with worker threads that handle request processing. By preserving a bootstrapped application state among GraphQL API requests, GraphQL Application Server enhances request handling and overall product performance. As a result, GraphQL request response time can be reduced by up to 30%.

The Application Server is supported on [Cloud Starter](https://experienceleague.adobe.com/en/docs/commerce-cloud-service/user-guide/architecture/starter-architecture) deployments only. It is not available for Cloud Pro projects during Beta. It is not available for deployments of the Magento Open Source code base.
GraphQL Application Server is available for Adobe Commerce only. It is not available for Magento Open Source. You must [submit an Adobe Commerce Support ticket](https://experienceleague.adobe.com/en/docs/commerce-knowledge-base/kb/help-center-guide/magento-help-center-user-guide) to enable GraphQL Application Server on Pro projects.

## Challenges to consider

Ensuring compatibility between your extension and the Application Server can be challenging without the right information.
Ensuring compatibility between your extension and GraphQL Application Server can be challenging without the right information.

This page provides all the details that you need to make sure that your code is compatible with the Application Server, including recommendations and testing instructions. Key concepts include:
This page provides all the details that you need to make sure that your code is compatible with GraphQL Application Server, including recommendations and testing instructions. Key concepts include:

- Resource management
- Memory and resource leaks
Expand Down Expand Up @@ -49,15 +49,15 @@ Traditional debugging tools and techniques designed for synchronous PHP scripts

1. [Not following technical guidelines](../../coding-standards/technical-guidelines.md)

- 2.9. Service classes (ones that provide behavior but not data, like EventManager) SHOULD NOT have a mutable state. To make extensions codebase compliant with technical guidelines mutable states should be removed from Service classes. For example, a property cache introduced for better performance when dealing with data-intensive operations, such as database queries, API calls, or complex calculations, that does not need to be executed repeatedly within the same request. However, this can cause issues with the Application Server, since the property cache would be used in consequent requests and it should be reset after each request.
- 2.9. Service classes (ones that provide behavior but not data, like EventManager) SHOULD NOT have a mutable state. To make extensions codebase compliant with technical guidelines mutable states should be removed from Service classes. For example, a property cache introduced for better performance when dealing with data-intensive operations, such as database queries, API calls, or complex calculations, that does not need to be executed repeatedly within the same request. However, this can cause issues with GraphQL Application Server, since the property cache would be used in consequent requests and it should be reset after each request.

- 2.14. Temporal coupling MUST be avoided. Changed state at one point in time can inadvertently affect the behavior of subsequent operations, requiring a specific order of execution for the application to function correctly. This coupling makes the code harder to understand and maintain, as the correct operation of the system becomes dependent on the sequence in which state-modifying actions are performed.

1. Usage of superglobals, like `$_GET`, `$_POST`, and `$_SESSION`, and native PHP functions for header, session, and cookie, instead of utilizing interfaces through dependency injection.

## Integration testing

This section describes integration tests that you can use when developing your extension to ensure compatibility with the Application Server.
This section describes integration tests that you can use when developing your extension to ensure compatibility with GraphQL Application Server.

### GraphQlStateTests

Expand Down Expand Up @@ -114,7 +114,7 @@ To set up local testing and debugging:
pecl install swoole
```

1. Route all GraphQL requests to the application server (nginx example):
1. Route all GraphQL requests to GraphQL Application Server (nginx example):

```php
location /graphql {
Expand All @@ -125,13 +125,13 @@ To set up local testing and debugging:
}
```

1. Run the application server with the CLI command:
1. Run the GraphQL Application Server with the CLI command:

```bash
bin/magento server:run
```

1. Execute GraphQL mutations against the application server and debug with xDebug if needed.
1. Execute GraphQL mutations against GraphQL Application Server and debug with xDebug if needed.

## Example of mutable state in code

Expand Down

0 comments on commit c8f9b78

Please sign in to comment.