It was either a short story or a novel. I read it about 20 years ago, and some vague memory of it stuck.
It's set in a future where everyone's allotted role is decided by a series of tests once they reach a certain age. They are then classified into a group which decides what jobs they will do.
Our hero rather controversially gets a perfect score in the tests. Nobody had done that in a long time. and at first he worries about what this might mean. He is sent to work for the mysterious scientists who maintain the computer that runs society. Most people don't know they exist. He is disappointed to learn he has to be their tea boy, and learn a tea making ceremony perfectly.
In the process he learns how to fool the machine, and eventually to circumvent the controls society has placed on him. He makes several visits to an area outside the control of the machine - where people are living in poverty and lawlessness.
Can't remember the author, or the name, just that basic idea, and the fact that early in the book is a very grand "tea ceremony" where he must make the tea perfectly.