We are moving to a load-balanced solution where there will be several Umbraco instances on different machines pointing to a load-balanced SQL instance. Since we are using Formulate on our system, we were wondering what we need to ensure that the form submissions are loadbalanced and handled appropriately.
Does the SMTP service block when sending emails? Is there a sessional aspect to the code? If so, how to we ensure that the session is retained across multiple servers in the case that it is switched?
Replicating the data across SQL Server instances would be the same as for any data, so nothing Formulate-specific to consider there. IIRC, Formulate uses GUID's rather than ints for keys, so collisions across instances should be unlikely (not sure if that's a consideration with your setup, but thought I'd mention it just in case).
The only thing that is something like a session is the request verification token. Seems like setting a machine key in your web.config should ensure this works across load balanced servers: https://stackoverflow.com/a/3421373/2052963
If a lot of people submitted forms and these were set to storage and email, does Formulate drop these send requests into a mail queue so the user can get a "Thank you" message immediately?
Or could a very busy server, with an overwhelmed SMTP service, cause delays in the user experience or the writing of the submission to the database? Thus, could the SMTP process block the workflow of the form submission, whilst waiting for an "email sent" response?
ps. Nice tip re: verification token.
pps. Looking at code. Thanks for the feedback!
If a lot of people submitted forms and these were set to storage and email, does Formulate drop these send requests into a mail queue so the user can get a "Thank you" message immediately?
Emails are sent on a background thread. Users get the thank you message before an attempt is made to send emails. Formulate is async by default.
Only real issue you might come across is if lots of threads were running at one and you ran into a limit for maximum number of parallel threads, or if the threads were very long running (e.g., if some process kills very long running background threads).
I haven't run into either scenario myself, but would recommend you do some load testing to be sure you don't run into issues. Worst case scenario, the code can be slightly rewritten (e.g., to use a queue for emails in a single thread rather than managing each on their own thread).
Formulate in a load balanced environment
Hello
We are moving to a load-balanced solution where there will be several Umbraco instances on different machines pointing to a load-balanced SQL instance. Since we are using Formulate on our system, we were wondering what we need to ensure that the form submissions are loadbalanced and handled appropriately.
Does the SMTP service block when sending emails? Is there a sessional aspect to the code? If so, how to we ensure that the session is retained across multiple servers in the case that it is switched?
Thank you for your time in answering this
Replicating the data across SQL Server instances would be the same as for any data, so nothing Formulate-specific to consider there. IIRC, Formulate uses GUID's rather than ints for keys, so collisions across instances should be unlikely (not sure if that's a consideration with your setup, but thought I'd mention it just in case).
Not sure what you mean. Perhaps looking at the code that Formulate uses to send emails will help you answer this question: https://github.com/rhythmagency/formulate/blob/6ce70e7cb8be672ce4b92f1ef0c4855c0b62a6dd/src/formulate.app/Forms/Handlers/Email/EmailHandler.cs#L360-L364
The only thing that is something like a session is the request verification token. Seems like setting a machine key in your web.config should ensure this works across load balanced servers: https://stackoverflow.com/a/3421373/2052963
Re: SMTP
If a lot of people submitted forms and these were set to storage and email, does Formulate drop these send requests into a mail queue so the user can get a "Thank you" message immediately?
Or could a very busy server, with an overwhelmed SMTP service, cause delays in the user experience or the writing of the submission to the database? Thus, could the SMTP process block the workflow of the form submission, whilst waiting for an "email sent" response?
ps. Nice tip re: verification token. pps. Looking at code. Thanks for the feedback!
Emails are sent on a background thread. Users get the thank you message before an attempt is made to send emails. Formulate is async by default.
BTW, here's the code where Formulate is creating background threads for the form submission handlers: https://github.com/rhythmagency/formulate/blob/ded17b103c06a8aaa38aa2dd61a7fbb391884d6d/src/formulate.api/Submissions.cs#L235-L251
Only real issue you might come across is if lots of threads were running at one and you ran into a limit for maximum number of parallel threads, or if the threads were very long running (e.g., if some process kills very long running background threads).
I haven't run into either scenario myself, but would recommend you do some load testing to be sure you don't run into issues. Worst case scenario, the code can be slightly rewritten (e.g., to use a queue for emails in a single thread rather than managing each on their own thread).
is working on a reply...