Mediamodifier Mockup API Speed Optimization Tips
One of the biggest advantages of our mockup API is the speed!
In addition to being the most customizable API with custom PSD source files and 4000 existing ready-to-use templates, it’s also built to be blazing fast!
However one of the biggest bottlenecks which might be slowing down your render time is the image size, network speed and rendering sequence – so here’s how to tackle these problems:
Case study: Rendering 8 images at the same time and optimizing from 12.4 seconds to 2.7 seconds.
Sending image data with a moderate network speed to a long distance server takes time.
That’s a fact and not a specific API server problem.
If your network’s upload speed can handle for example 2MB of data in 1 second, then 8 requests accumulates to 8 seconds minimum.
This bottleneck depends only on the network’s upload speed on where the request is sent from.
So even in the testing phase it’s important to think about sending the requests rather not from the local machines but from the cloud.
Our API servers are located in the AWS cloud.
For the best network speed it’s recommended to create a staging environment to AWS (or your own service provider) cloud where you deploy the backend and run the requests there.
In the following example we’ve created a test to run 8 API render requests in parallel from our AWS server located in Europe to our production Mockup API server (AWS, region us-east-1).
The request included 1 layer image data with the size of approx. 1.8MB
Here are the results:
—
Render Mockup nr 54227 Parallel 3: 1442.349ms
Render Mockup nr 54227 Parallel 5: 1461.064ms
Render Mockup nr 54227 Parallel 2: 1652.465ms
Render Mockup nr 54227 Parallel 7: 2086.514ms
Render Mockup nr 54227 Parallel 1: 2383.667ms
Render Mockup nr 54227 Parallel 8: 2338.447ms
Render Mockup nr 54227 Parallel 4: 2522.743ms
Render Mockup nr 54227 Parallel 6: 2640.244ms
Render Time in Parallel Total: 2.759s
—
In comparison we’ve made the same request from a local machine with home internet connection via WiFi (upload speed ~15Mbps) to the AWS server in us-east-1:
—
Render Mockup nr 54227 Parallel 8: 3712.163ms
Render Mockup nr 54227 Parallel 7: 5558.287ms
Render Mockup nr 54227 Parallel 4: 5880.342ms
Render Mockup nr 54227 Parallel 6: 5970.981ms
Render Mockup nr 54227 Parallel 2: 7075.924ms
Render Mockup nr 54227 Parallel 5: 7135.513ms
Render Mockup nr 54227 Parallel 1: 12347.047ms
Render Mockup nr 54227 Parallel 3: 12378.730ms
Render Time in Parallel Total: 12.419s
—
Summary: Follow these Tips
- The size of the mockup – big and heavy PSD files render slower. Ideal speed and quality ratio is in the 800-1500px range.
- The size of the images sent to the API – larger images take longer to upload.
- The network speed of the server where the requests are sent from;
- And most importantly: All the render requests can also be sent in parallel at the same time, not in a sequence. So if your use-case requires rendering multiple mockups, then this can also drastically improve your render times because all render requests can be sent out instantaneously without waiting for the previous one to be completed first.
I hope these speed tips have been helpful. If you have any further questions about getting started with our API and how it can boost your online business, be sure to book a demo call with us to learn more.