A young boys friend is kidnapped. Enrols in a school as a warden. Goes to a City giant snake


Possibly a Darkfriend
In the book a young boys best friend is kidnapped by slavers posing as soldiers. He tries to save her but failes. He travels to a new city with his father (who beats him) and mother. Once he arrives in the city he enrols in a academy to become a warden (I think) He then ends up going to a city with a giant snake.

Any help with the title of the book would be appreciated