How can I troubleshoot and resolve the issue of “concurrentperorglongtxn limit exceeded”?
I am a cloud architect and I am designing a highly scalable application architecture on AWS. One of my services is experiencing the error of “concurrentperorglongtxn limit exceeded” because of high concurrency levels. How can I analyze and address this particular issue?
In the context of Salesforce, you can troubleshoot and resolve the issue of “concurrentperorglongtxn limit exceeded” by using the several steps which are given below:-
Analysis of current usage
You can use AWS Cloud watch metrics and logs to analyze the current usage patterns, identifying spikes in concurrency, and understanding which resource or service is causing this particular issue:-
Aws cloud watch get-metric-statistics –namespace AWS/ApplicationELB
--metric-name ConsumedWriteCapacityUnits –dimensions Name=LoadBalancer,Value=MyLoadBalancer
--start-time 2024-03-01T00:00:00 –end-time 2024-03-10T00:00:00 –period 3600 --statistics Sum
Optimization of application code:-
You can review your application's code for the purpose of identifying any inefficient operations or bottlenecks that might be causing high concurrency. You can optimize the database queries, reduce the locking period, and implement a caching mechanism where applicable.
Here is the example given of optimization of database queries in Python programming language by using AWS SDK for DynamoDB:-
Scale resources
You can try to consider scaling up or horizontal scaling your AWS resources such as Amazon RDS instance, and Amazon EC2 Instance to handle higher concurrency levels effectively. Here is an example of scaling the Amazon RDS Instance by using the AWS command line interface:-
Aws rds modify-db-instance –db-instance-identifier MyDBInstance
--allocated-storage 100 –db-instance-class db.t2.medium
Implement rate limiting
You can use the AWS services like Amazon API gateways for the purpose of implementing rate limiting and throttling mechanisms for the purpose of controlling the number of requests:-
Aws apigateway update-stage –rest-api-id MyAPIID –stage-name MyStage
--patch-operations op=replace,path=/throttling/rateLimit,value=1000
Monitoring and auto-scaling
You can set up AWS auto-scaling for the purpose of automatically adjusting Resources based on the demand and Configuration of cloudwatch alarms to monitor concurrency levels and trigger scaling actions when the limit is approaching maximum.
Here is the example given of creating a cloud watch alarm for high CPU utilization:-
Aws cloud watch put-metric-alarm –alarm-name HighCPUAlarm
--metric-name CPUUtilization –namespace AWS/EC2 –statistic Average
--comparison-operator GreaterThanThreshold –threshold 80 –period 300
--evaluation-periods 2 –alarm-actions “arn:aws:sns:us-east-1:123456789012:MySNSAlarmTopic”