File take a lot of time to upload in IPFS

HI!
I’m trying to upload Image, Video, and 3d models into IPFS but it seems to take a lot of time.
I’ve tried uploading Images ranging from 100-200 KB and it basically takes 4-5 seconds to upload the image. Whereas, uploads of video and 3d model takes around 15-30 seconds for 5-12 MB files.

// Uploading thumbnail to ipfs
const thumbIpfs = new this.$moralis.File(thumbnail.file.name, thumbnail.file)
await thumbIpfs.saveIPFS()

// Uploading video to ipfs
const videoIpfs = new this.$moralis.File(video.name, video)
await videoIpfs.saveIPFS()

// Uploading 3d/AR model to ipfs
const glbIpfs = new this.$moralis.File(ar.glb[0].name, ar.glb[0])
await glbIpfs.saveIPFS()

I use the code above to upload the files. Is there any way to improve the upload & download performance for it? or should I just opt to uploading the file in my private server?

Thank you for the help! :slight_smile:

1 Like

I did a test now with await moralisFile.save() for a file of ~1MB and it took somewhere between 1 and 2 seconds for me.

I got similar time for uploading to IPFS for ~1MB file.

How does the usage of you Moralis server CPU and RAM looks like in your admin interface?

The usage in the Dashboard shows
CPU = 5.0%, RAM = 52%

ok, so this should not be the problem.
Do you know what is your upload speed for your internet connection?
If you would upload to another server 10MB you know that it would be faster?

Yes, I’ve tried uploading it to other server. And the upload speed for a file of 8MB takes around 15 seconds to upload in IPFS. Whereas, the upload on other server takes 4-5 seconds.

I tested now with a file that has ~9MB and it took close to 5 seconds to upload it to IPFS.

Do you remember what region you choose when you created your Moralis server?
Maybe it would work faster if you choose a region closer to you or to your users.

Yes ser. I was using server in another region. But I’ve just created a server region near me. But still it’s the same.

That sounds strange, I’ll test later with different server types: dev, testnet, mainnet.

I did some tests with this code:


        console.time('test_upload_time')
        moralisFile = new Moralis.File("moralis_file_.jpg", document.getElementById("avatar").files[0]);
        moralisFile.save().then(function(file) {
          console.log("upload done", file)
          console.timeEnd('test_upload_time');
        }, function(error) {
          console.log("there was an error", error);
          console.timeEnd('test_upload_time');
        }); 

Sometimes I get 2 seconds, sometimes I can get 8 seconds, for a file with ~9MB on a dev server, on mainnet I get 4 seconds usually.