A method for serving a file using a server coupled to a data network, wherein serving includes organizing data of the file into one or more blocks, generating one or more encoded symbols for a block based on the data of the block, and wherein at least one block is physically or logically organized into a plurality of sub-blocks and at least one encoded symbol is physically or logically organized into a plurality of sub-symbols, the method comprising:
- partitioning an input file into an integer number of blocks, wherein each block includes at least one sub-block, and wherein each sub-block includes at least one source symbol;
- determining a value, WS, representing a maximum size for a sub-block based on a memory constraint;
- determining a value SS, wherein SS*AL represents a lower bound for sub-symbol size, in units of a preferred memory unit size, AL;
- determining which blocks of the integer number of blocks is to be organized into a plurality of sub-blocks, and for each such block, organizing the block into a plurality of sub-blocks having a size determined by the available space within packets for encoded symbols that are to be sent, a symbol size that is to be used within each sent packet, in a manner to ensure that a number of source symbols for source blocks is equal within a threshold and the number is equal to the number, Kt, of source symbols in the file and to ensure that the sub-symbol size of each sub-block is at most SS*AL and to ensure that the size of each sub-block is at most WS;
- generating encoded symbols from blocks, wherein sub-symbols are generated from sub-blocks such that each encoded symbol depends on data from one block;
- and
- outputting the generated encoded symbols.