Skip to content

Commit 5eadb83

Browse files
authored
Update to the demo readme (#19)
* Update to the demo readme * ACA auto scaling * restore provider.conf.json * Update demo readme. Remove patterns from MWA and add a reference * Remove patterns from RWA and add a reference
1 parent 3a77263 commit 5eadb83

12 files changed

+69
-12
lines changed

demo.md

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
# Pattern Simulations
22

3+
You can test and configure the code-level design patterns introduced in this implementation: strangler fig, queue-based load leveling and competing consumers, and distributed tracing. The following paragraphs detail steps to test these code-level design patterns.
4+
5+
As an evolution of the Reliable Web App (RWA), the Modern Web App (MWA) reference sample also includes design patterns that were showcased in RWA: retry, circuit-breaker, and cache-aside. For more information on these patterns and how to test them (both in RWA and MWA), see [Reliable Web App Pattern Simulations](https://github.com/Azure/reliable-web-app-pattern-java/blob/main/demo.md).
6+
37
## Strangler Fig Pattern
48

59
Read the [Strangler Fig Pattern](./docs/SranglerFig.md) documentation.
610

7-
After you deploy CAMS using `azd up`, the application is configured to use the legacy email service. This is simulated by issuing a log message when the email functionality is called. To simulate the functionality, follow the steps below:
11+
After you deploy CAMS using `azd up`, the application is configured to use the new email service. The default value for `CONTOSO_SUPPORT_GUIDE_REQUEST_SERVICE` is set to `queue` for the App Service. Email requests go to the Azure Service Bus and are processed by the `email-processor` container app. This setting is defined in Azure App Configuration.
12+
13+
![edit-application-setting](./docs/assets/edit-application-setting.png)
14+
15+
To simulate the functionality, follow the steps below:
816

917
1. Open the CAMS application in a browser.
18+
1. Upload a support guide by clicking on the `Support Guides` link in the navigation bar and click `Upload New Guide`. The guides are located in the `contoso-guides` directory.
19+
20+
![support-guids-location](./docs/assets/support-guides-location.png)
21+
22+
![upload-support-guide](./docs/assets/upload-support-guide.png)
23+
1024
1. Add an Account by clicking on the `Accounts` link in the navigation bar and click `Add Account`.
1125

1226
![Add Account](./docs/assets//add-account.png)
@@ -17,15 +31,6 @@ After you deploy CAMS using `azd up`, the application is configured to use the l
1731

1832
1. Click on the support case and and then click the `Email Customer` button. You will see log message in the support case that the email was sent.
1933

20-
![send-email-legacy](./docs/assets/send-email-legacy.png)
21-
You will also see a log message from the email service that the email was sent in the Azure portal.
22-
23-
![send-email-legacy-log](./docs/assets/send-email-legacy-log.png)
24-
25-
1. To see email requests go to the Azure Service Bus, change the `CONTOSO_SUPPORT_GUIDE_REQUEST_SERVICE` environment variable to `queue` for the App Service.
26-
27-
![edit-application-setting](./docs/assets/edit-application-setting.png)
28-
2934
1. Navigate to the Container App in the Azure portal and click on the `Log Stream` link in the left navigation.
3035

3136
![app-service-log-stream](./docs/assets/app-service-log-stream.png)
@@ -34,10 +39,60 @@ You will also see a log message from the email service that the email was sent i
3439

3540
![container-app-log-stream](./docs/assets/container-app-log-stream.png)
3641

37-
1. Follow the same instructions to send an email to the customer. You will see the log messages from the `email-processor` container app and `CAMS`. Refresh the page and you will see that `CAMS` processed a response from the `email-processor`.
42+
You will see the log messages from the `email-processor` container app and `CAMS`.
43+
44+
**Note**: It may take a few minutes for the message to be processed and the logs to appear.
45+
46+
1. Refresh the page and you will see that `CAMS` processed a response from the `email-processor`.
3847

3948
![send-email-queue](./docs/assets/send-email-queue.png)
4049

4150
1. Navigate to the Azure Service Bus in the Azure portal. You will see a spike in incoming messages.
4251

4352
![service-bus-incoming-messages](./docs/assets/service-bus-incoming-messages.png)
53+
54+
To see messages go though the old email service, change the value of the `CONTOSO_SUPPORT_GUIDE_REQUEST_SERVICE` key to `email` in Azure App Configuration. This is simulated by issuing a log message when the email functionality is called.
55+
56+
![send-email-legacy](./docs/assets/send-email-legacy.png)
57+
58+
You will also see a log message from the email service that the email was sent in the Azure portal.
59+
60+
![send-email-legacy-log](./docs/assets/send-email-legacy-log.png)
61+
62+
## Distributed Tracing
63+
64+
You can also simulate the Strangler Fig Pattern and view the distributed tracing logs in Azure Monitor.
65+
66+
1. Navigate to the Azure Application Insights in the Azure portal and select the **Transaction Search** blade. Search for `New Message Received` to see the trace messages from the `email-processor` container app and the `CAMS` application running on App Service.
67+
68+
![transaction-search](./docs/assets/app-insights-transaction-search.png)
69+
70+
1. Click on the `New Message Received` transaction to see the details.
71+
72+
![transaction-details](./docs/assets/app-insights-transaction-details.png)
73+
74+
## Autoscaling Email Processor
75+
76+
The `email-processor` container app is configured to autoscale based on the number of messages in the Azure Service Bus. The `email-processor` container app scales out when the number of messages in the Service Bus exceeds a certain threshold.
77+
78+
![autoscale-settings](./docs/assets/email-processor-scaling-rule.png)
79+
80+
To simulate the autoscaling, follow the steps below:
81+
82+
1. Navigate to Azure App Configuration and change the `CONTOSO_SUPPORT_GUIDE_REQUEST_SERVICE` value to `demo-load`.
83+
84+
![edit-application-setting](./docs/assets/edit-application-setting-demo-load.png)
85+
86+
1. Restart the Web App in App Service.
87+
88+
![restart-app-service](./docs/assets/restart-app-service.png)
89+
90+
1. Send an email following the steps in the Strangler Fig Pattern section.
91+
92+
1. Navigate to the Azure Service Bus in the Azure portal. You will see a spike in incoming messages.
93+
94+
![service-bus-incoming-messages](./docs/assets/service-bus-request-queue-load-demo.png)
95+
96+
1. Navigate to the Container App in the Azure portal and click on the `Revisions and replicas` link under `Application` in the left navigation. Finally, click on the `Replicas` tab. You will see that the number of replicas has increased.
97+
98+
![container-app-revisions-replicas](./docs/assets/container-app-revisions-replicas.png)

docs/SranglerFig.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ The new email service is implemented (here)[https://github.com/Azure/modern-web-
2222

2323
4. **Gradually migrate functionality**: The email functionality is gradually migrated from the old service to the new service. This can be done by routing a percentage of the email requests to the new service and gradually increasing the percentage over time.
2424

25-
Change the `CONTOSO_SUPPORT_GUIDE_REQUEST_SERVICE` environment variable from `email` to `queue` to migrate the email functionality to the new email service that's integrated with Azure Service Bus.
25+
The `CONTOSO_SUPPORT_GUIDE_REQUEST_SERVICE` environment variable changes the behavior of CAMS. Possible values for `CONTOSO_SUPPORT_GUIDE_REQUEST_SERVICE` are `email` and `queue`.
26+
* `email` refers to the old functionaly where the the monolithic CAMS application sent out emails directly.
27+
* `queue` is the new functionality where messages are sent to to the new email service through Azure Service Bus.
2628

2729
![request-service-email-setting](assets/request-service-email-setting.png)
2830

674 KB
Loading
380 KB
Loading
459 KB
Loading
313 KB
Loading
25.6 KB
Loading
543 KB
Loading

docs/assets/restart-app-service.png

260 KB
Loading
425 KB
Loading

0 commit comments

Comments
 (0)