I would recommend to use the Shopware Sync API and maybe import the data in chunks instead of the whole payload at once.
See: https://shopware.stoplight.io/docs/admin-api/faf8f8e4e13a0-bulk-payloads