Serve content from zip files
NetStorage offers a “Serve from Zip” feature that allows it to dynamically examine archive files and directly serve individual files from within them. Without this feature, an archive file would have to be completely unzipped to serve its contents, which could be a lengthy process if it contained a large number of files. Serve from Zip replaces the unzip process with an indexing command that verifies the file’s integrity and adds a hash table to facilitate locating specific files within it.
- Requirements. Serve from zip creates an index, and the filename use a “.zip” extension.
- It eliminates the “unzip” process. Individual files are available almost immediately.
- File installation bottlenecks can be bypassed. Since many individual files are compressed into a single archive, this undesired slow-down can be avoided.
- It offers single file management capability. Contents that are updated and deleted in groups can be managed as one file rather than many separate files.
How to enable Serve from Zip
The Serve from Zip functionality must be enabled on a per-upload directory basis for each applicable storage group.
Enable Serve from Zip using the NetStorage UI
- Open the application. Go to ☰ ⇒ ORIGIN SERVICES ⇒ NetStorage .
- Select the Storage Groups entity.
- Create or edit a storage group.
- Create or edit an upload directory.
- Enable the Serve From Zip option.
Enable Serve from Zip using the NetStorage Configuration API
Set serveFromZip=true
for your intended storage group and upload directory (cpcodeId
). See the NetStorage Configuration API for full configuration details.
Example upload directory modification
{
"contractId": "5-555V556",
"storageGroupName": "aka_storage",
"domainPrefix": "baseball",
"cpcodes": [
{
"cpcodeId": "456789",
"serveFromZip": true
}
]
}
Index your archives to use with Serve from Zip
To use the Serve from Zip feature, the archive needs an index applied to create a hash table of its contents. The hash table is then added to the “.zip” archive as a comment. You should enable Serve from Zip for your storage group or the indexed zip files will become corrupt and unusable.
You should enable Serve from Zip for your storage group or the indexed zip files will become corrupt and unusable.
Indexing an archive requires that the filename use a “.zip” extension. You can add an index using any of these methods:
Apply auto-indexing to your upload account
You can't copy or move zip files that are uploaded with auto indexing. They need to remain in the original location where they were uploaded. Attempting to move the file will trigger re-indexing and a subsequent failure.
Auto-indexing is available for Aspera, Rsync, SCP, SFTP, and FTP protocols. Apply these steps to enable auto-indexing on your upload account:
- Access the Upload Accounts entity from the NetStorage UI in Control Center.
- Edit the upload account you want to apply auto-indexing.
- Navigate to the Advanced Settings section of the upload account.
- Select Append serve-from-zip index from the On Zip File Upload section.
Auto-index will always index zip files for that upload account. This limits the use of Rsync or Aspera sync to upload only, as auto-indexing will change MD5 signatures and sizes that prevent the use of synchronization features. Auto-indexing doesn’t apply to File Manager or the HTTP Usage API.
Use the az2z command with FTP
Apply a zip index with FTP by performing these steps:
- Establish an FTP connection to the applicable NetStorage storage group.
- Issue the
site az2z
command from the FTP terminal. - Upload the file as necessary.
- The
site az2z
command needs to be re-entered prior to each archive file upload, and the subsequent upload must be initiated from the same FTP session.- An error will be generated if the file uploaded isn't an archive file.
- FTP is an insecure protocol. Some GUI FTP clients don't support site commands.
Use the az2z command with CMShell
Apply a zip index with CMShell by performing these steps:
- Upload the archive file(s) to NetStorage using whatever means you prefer. This can be any of the protocols covered in this document or even via the FileManager tool available in Akamai Control Center.
- Make note of the complete path to all uploaded archive files.
- Access CMShell.
- Run the
az2z <archive_file>
command for each archive.
- If you unzip an indexed archive file with a tool that displays comments (for example, the unzip command available for use with CMShell), the table hash is listed among the archive’s contents, appearing as garbled text.
- Using CMShell adds an extra step that reads and writes the whole file instead of adding just the index while uploading.
Use the NetStorage Usage API
Use the API's upload
action with the index-zip=1
option to enable az2z processing. This will index an uploaded “.zip” archive for the “Serve from Zip” feature. The API allows full control over whether of not to index zip files without having to switch upload accounts.
Additional details on the use of the upload action can be found in the NetStorage Usage API.
Serve from Zip considerations
Recommendations and limitations for indexed zip files
Consider storing your zip files in different upload directories if serving indexed content impacts your performance. These limitations apply to indexed zip files:
- Don't use NetStorage as your master copy. Indexed zip files stored on NetStorage has a different MD5 than what was uploaded. You won't be able to verify going back.
- Don't check the MD5 or files size of indexed files on NetStorage. Use the return response from most protocol clients to confirm a successful transfer.
- Don't use Aspera sync, Rclone, or Rsync with indexed zip files. All sync operations require matching file sizes. Indexing a NetStorage zip file will always change the file size, causing sync operations to continuously upload files which will result in a lot of extra bandwidth.
Review this table of frequently asked questions and considerations:
Consideration | Description |
---|---|
NetStorage translates backslashes when indexing | When indexing archive files, NetStorage translates backward slashes ( \ ) to forward slashes ( / ).This can be problematic if the archive contains any UNIX system-based files with that character in their name. You can overcome this problem by uploading the file external to the archive (i.e., do not include it in the archive, and upload it separately). |
Archive file size or object limitations | Archive files are limited as follows:
As a workaround, you can upload multiple archive files that fit within these restrictions. |
Multiple disk archive files are not supported | You cannot use multiple disk archive files with Serve from Zip. |
No Support with “FTP Download” | If you are using NetStorage as your origin for the FTP Download product, Serve from Zip is not supported for use. |
Byte-range requests | Byte-range requests are not supported for zip indexed files.
|
The indexing operation adds information to the archive file | If the CMShell command, md5sum is run after indexing, the hash differs from that of your local archive version. For the same reason, running FTP’s site az2z command in tandem with its site chkhash <MD5Digest> command produces an error. |
Can be problematic for NetStorage’s “MD5 Sum” feature | This setting is set via the Upload Directory Attribute interface in Control Center. |
Only basic zip format features are supported | For example, encryption and bzip compression are not supported. |
Emergency directories or stale content protection are not supported | Zip logic does not support these features. |
Aspera does not support zip indexing as part of the upload | After a zip archive is uploaded via Aspera, the indexing must be done separately using the CMShell az2z command. |
Double indexing an archive is not supported | Once a file has been indexed, any attempt to re-index the same file will result in failure. |
You can use these archive utilities |
|
Serve from Zip uses relative paths | Uploaded zip files should contain relative paths that do not start with a slash ( / ). Absolute paths starting with a slash are not supported. |
What does auto-indexing do to a zip file pre-indexed? | Error 451 will occur after uploading pre-indexed zip files with auto-index enabled, and the file will not transfer to NetStorage. |
What does the CMShell “az2z” cmd do to a zip file that was auto-indexed? | Once a file has been indexed, any attempt to re-index the same file will result in failure. |
How do I find out which zip files are, or are not, indexed? | Indexed zip file MD5s and file sizes stored on NetStorage will not match your local copy:
Otherwise you'll need to know the name of a sub-object within each zip file (e.g., a video manifest name.) and be able to download via a delivery config using serve-from-zip.
|
How do I remove the Akamai index from a zip file on NetStorage? | Removing an index isn't supported. Re-upload the original zip file without auto-indexing to replace an indexed zip file. |
How do I upload zip files without auto-indexing? | You can choose any of these options:
|
Updated almost 2 years ago