Hi.
We are generating pdfs in a .net 6 web api hosted in IIS. When ran locally on the developers machine the pdf’s are generated in ~ 1 - 5 seconds, depending upon the complexity and amount of data passed to the report. However running the same application on an EC2 server, the execution times increase by a factor of ~4. This makes the PDF generation process unusable by our customers.
We are trying to find an explanation and a fix to this situation.
Here’s the details of our environment.
We are generating pdf’s using the GeneratePdfFromJson method.
Our data structures are simple collections and not deep hierarchies. See example below.
There’s no images or anything complex in the report.
The EC2 instance is a standard windows server running IIS.
The CDS files are read from disk on each generation request
We have tried with both t2.mediun and t2.large server sizes, with no real difference in times.
Thanks in advance.
Example of POCO used to serialize into Json.
public class PeriodTracking : IReportRequest
{
public HeaderFooter HeaderFooter { get; set; }
public List<Analysis> Analysis { get; set; }
public List<Detail> Details { get; set; }
public GrandTotals GrandTotals { get; set; }
}
public class Analysis
{
public int DetailType { get; set; }
public string DetailTypeDesc { get; set; }
public string AnalysisType { get; set; }
public string Name { get; set; }
public string ShiftTimes { get; set; }
public double SalesAmt { get; set; }
public double SalesPct { get; set; }
public double SalesPctIncr { get; set; }
public int TransAmt { get; set; }
public double TransPct { get; set; }
public double TransPctIncr { get; set; }
public double AverageChequeAmt { get; set; }
public double AverageChequePctIncr { get; set; }
}
public class Detail
{
public int DetailType { get; set; }
public string DetailTypeDesc { get; set; }
public string BusinessDate { get; set; }
public string LineTitle { get; set; }
public double SalesLastYear { get; set; }
public int SalesProjected { get; set; }
public double SalesActual { get; set; }
public double SalesPctIncr { get; set; }
public int TransActual { get; set; }
public double TransPctIncr { get; set; }
public double AverageCheque { get; set; }
public double WasteRawPct { get; set; }
public double WasteCompletedPct { get; set; }
public double WasteTotalPct { get; set; }
public double WasteRawCost { get; set; }
public double WasteCompletedCost { get; set; }
public int VariationCost { get; set; }
public string LabourHoursProjectedHhmm { get; set; }
public string LabourHoursActualHhmm { get; set; }
public double SPMHProjected { get; set; }
public double SPMHActual { get; set; }
public double CrewLabourPct { get; set; }
public double CrewAHR { get; set; }
public double CrewTPMH { get; set; }
}
public class GrandTotals
{
public double NetSales { get; set; }
public double LeviableSales { get; set; }
public double CashOverShortAmt { get; set; }
public int CashOverShortPct { get; set; }
public int LabourExtraCrew { get; set; }
public double LabourOther { get; set; }
public double LabourCombined { get; set; }
public int PrevYrSalesIncr { get; set; }
public int PrevYrTransIncr { get; set; }
}
public class HeaderFooter
{
public string ReportTitle { get; set; }
public string StoreName { get; set; }
public string PeriodName { get; set; }
public string PrintName { get; set; }
public string OptionName { get; set; }
public string SoftwareVersion { get; set; }
public string LeviableName { get; set; }
public string SalesTaxName { get; set; }
}
Here’s the details