graphql-dotnet / graphql-dotnet/graphql-client

High CPU Usage

Open
#668 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
648
Forks
136
PR merge metrics
No merged PRs in 30d

Description

Hi,

I am investigating a problem with high CPU usage. Here is my server:

Windows Azure
Premium v2 P2V2
210
CPU 2
Memory 7
Remote Storage 250
Scale 30

I am not using the same server with 4 CPU and 14 GB memory and the server is fine. Does GraphQL require more CPU and RAM?

Here is my graph QL query:

string commonFields = @"
fragment OrderFields on Order {
customer {
firstName
lastName
}
id
name
note
createdAt
updatedAt
email
discountCode
tags
channelInformation {
channelId
channelDefinition {
handle
channelName
}
}
registeredSourceUrl
sourceIdentifier
displayFinancialStatus
displayFulfillmentStatus
cancelReason
cancelledAt
closedAt
confirmed
currencyCode
paymentGatewayNames
poNumber
taxesIncluded
test
totalDiscounts
totalPrice
totalTax
totalWeight
fulfillments {
location{
id
name
}
id
status
trackingInfo {
company
number
url
}
createdAt
updatedAt
order {
id
}
}
originalTotalDutiesSet {
presentmentMoney {
amount
currencyCode
}
shopMoney {
amount
currencyCode
}
}
app {
id
name
}
taxLines{
channelLiable
price
rate
ratePercentage
title
}
discountApplications(first: 100) {
edges {
node {
value {
... on MoneyV2 {
__typename
amount
currencyCode
}
... on PricingPercentageValue {
__typename
percentage
}
}
allocationMethod
index
targetSelection
targetType
... on DiscountCodeApplication {
__typename
code
allocationMethod
index
targetSelection
targetType
value {
... on MoneyV2 {
__typename
amount
currencyCode
}
... on PricingPercentageValue {
__typename
percentage
}
}
}
... on ManualDiscountApplication {
description
value {
... on MoneyV2 {
__typename
currencyCode
amount
}
... on PricingPercentageValue {
__typename
percentage
}
}
allocationMethod
index
targetSelection
targetType
title
}
... on ScriptDiscountApplication {
__typename
allocationMethod
description
targetSelection
index
targetType
value {
... on MoneyV2 {
__typename
currencyCode
amount
}
... on PricingPercentageValue {
__typename
percentage
}
}
title
}
}
}
}
shippingLines(first: 10){
edges {
node {
id
code
price
originalPriceSet {
shopMoney {
amount
currencyCode
}
presentmentMoney {
amount
currencyCode
}
}
source
title
discountedPriceSet {
shopMoney {
amount
currencyCode
}
presentmentMoney {
amount
currencyCode
}
}
taxLines {
rate
title
price
priceSet {
presentmentMoney {
amount
currencyCode
}
shopMoney {
amount
currencyCode
}
}
}
}
}
}
lineItems(first: 30) {
edges {
node {
id
title
name
sku
quantity
totalDiscount
variantTitle
customAttributes {
key
value
}
variant {
id
}
product {
id
}
fulfillmentService {
serviceName
}
discountAllocations {
discountApplication {
index
}
allocatedAmount {
amount
}
allocatedAmountSet {
presentmentMoney {
amount
currencyCode
}
shopMoney {
amount
currencyCode
}
}
}
vendor
isGiftCard
requiresShipping
fulfillableQuantity
originalUnitPrice
taxLines {
price
rate
title
priceSet {
presentmentMoney {
amount
currencyCode
}
shopMoney {
amount
currencyCode
}
}
}
originalUnitPriceSet {
shopMoney {
amount
currencyCode
}
presentmentMoney {
amount
currencyCode
}
}
discountedUnitPriceSet {
shopMoney {
amount
currencyCode
}
presentmentMoney {
amount
currencyCode
}
}
}
}
}
currentTotalDiscountsSet {
presentmentMoney {
amount
currencyCode
}
shopMoney {
amount
currencyCode
}
}
currentSubtotalPriceSet {
presentmentMoney {
amount
currencyCode
}
shopMoney {
amount
currencyCode
}
}
currentTotalPriceSet {
presentmentMoney {
amount
currencyCode
}
shopMoney {
amount
currencyCode
}
}
currentTotalTaxSet {
presentmentMoney {
amount
currencyCode
}
shopMoney {
amount
currencyCode
}
}

transactions(first: 5) {
paymentDetails {
... on CardPaymentDetails {
avsResultCode
company
cvvResultCode
number
name
paymentMethodName
bin
}
}
amount
createdAt
id
kind
gateway
formattedGateway
status
test
amountSet {
presentmentMoney {
amount
currencyCode
}
shopMoney {
amount
currencyCode
}
}
}

tags
shippingAddress {
firstName
lastName
address1
address2
city
country
zip
company
provinceCode
countryCode
province
phone
name
longitude
latitude
}
billingAddress {
firstName
lastName
address1
address2
city
country
zip
company
provinceCode
countryCode
province
phone
name
longitude
latitude
}
}";
if (finalQuery.Contains("gid://shopify/Order/"))
{
gqlQuery = $@"
{commonFields}
query {{
order(id:""{finalQuery}"") {{...OrderFields
}}
}}
";
}
else
{
gqlQuery = $@"
{commonFields}
query ($first: Int, $after: String) {{
orders(first: $first, after: $after, query: ""{finalQuery}"") {{
edges {{
node {{
...OrderFields
}}
}}
pageInfo {{
hasNextPage
endCursor
}}
}}
}}";
}

response = await _client.SendQueryAsync(new GraphQLRequest
{
Query = query
});

I also loop through and map the fields:

![Image](https://github.com/user-attachments/assets/ed83b633-d70f-4205-867f-15307c09f08d)

Let me know your thoughts.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.