Maybe this is obvious to everybody, but anyway ... the
gentlemen rankers of the poem where men of good family that could have tried to be
officers, but instead enlisted as
rankers (at times under an assumed name) as a quick way to disappear from England because of some scandal.
I like this poem because of its mixture of desperation, hardiness and dark amusement at one's own state.
I suspect that the "machinely crammed" in the text referred to the study cramming that students underwent before trying to enter Sandhurst, usually at the hands of "crammers", that's to say private teachers.