A method of performing load balancing based on application layer messages, the method comprising: establishing, at a network element, a first association between a first set of criteria and a first load-balancing algorithm; establishing, at the network element, a second association between a second, different set of criteria and a second, different load-balancing algorithm; intercepting, at the network element, one or more first data packets comprising network layer or transport layer headers having a destination address that differs from an address of the network element; determining at least a portion of a first application layer message that is contained in one or more payload portions of the one or more first data packets; determining whether the portion of the first application layer message satisfies all criteria in the first set of criteria; in response to determining that the portion of the first application layer message satisfies all criteria in the first set of criteria, selecting, based on the first load-balancing algorithm that is associated with the first set of criteria, a first server from among a plurality of servers; and sending the same first application layer message toward the first server; in response to determining that the portion of the same first application layer message does not satisfy all criteria in the first set of criteria, determining whether the portion of the same first application layer message satisfies all criteria in the second set of criteria; and in response to determining that the portion of the same first application layer message satisfies all criteria in the second set of criteria, selecting, based on the second load-balancing algorithm that is associated with the second set of criteria, a second server from among the plurality of servers; and sending the same first application layer message toward the second server. establishing, at a network element, a first association between a first set of criteria and a first load-balancing algorithm; establishing, at the network element, a second association between a second, different set of criteria and a second, different load-balancing algorithm; intercepting, at the network element, one or more first data packets comprising network layer or transport layer headers having a destination address that differs from an address of the network element; determining at least a portion of a first application layer message that is contained in one or more payload portions of the one or more first data packets; determining whether the portion of the first application layer message satisfies all criteria in the first set of criteria; in response to determining that the portion of the first application layer message satisfies all criteria in the first set of criteria, selecting, based on the first load-balancing algorithm that is associated with the first set of criteria, a first server from among a plurality of servers; and sending the same first application layer message toward the first server; in response to determining that the portion of the same first application layer message does not satisfy all criteria in the first set of criteria, determining whether the portion of the same first application layer message satisfies all criteria in the second set of criteria; and in response to determining that the portion of the same first application layer message satisfies all criteria in the second set of criteria, selecting, based on the second load-balancing algorithm that is associated with the second set of criteria, a second server from among the plurality of servers; and sending the same first application layer message toward the second server.