Performance issue when process email containing useless big Style tag to small body content
Opened this issue · 1 comments
reinaldocoelho commented
The problem
We received some SPAM e-mails and when we will be process the content to inline CSS, the process uses a lot CPU and sometimes break down the Web Server.
When investigate to find what step of process break down, we found the problem on Inline CSS step, because the content has ~1.5 mb of style tag and only ~7kb of other contents.
Details
Premailer version: 2.4.0
Dotnet Framework: 4.8 ( we can't change to dotnet 5 :-/ )
Performance measured (dotnet Benchmark)
How to simulate
// Import the attached file.
var baseHtml = System.IO.File.ReadAllText("spam-big-style.html", Encoding.UTF8);
// Same process used when created the benchmark.
var resultHtml = PreMailer.Net.PreMailer.MoveCssInline(baseHtml, true, "link", null, true, true).Html;
Files
Attached one of the SPAM email received:
spam-big-style.zip
reinaldocoelho commented
Maybe when Style tag are so big, we can use an different strategy to process.