"Thanks for all the responses. They are so mixed which I suppose reflects the fact that everyone's situation is different. What I keep asking myself is 'If not now, when?'. Both DCs will probably have left home in about 6 years. But if we split up as soon as they leave that's bad too."
This is exactly the problem, OP. It really depends on why and in what ways the relationship isn't working.
Is it down to unrealistic ideas about how a relationship should be when you are many, many years into it and going through the daily grind together (like these occasional posters who complain they no longer feel "in love" with their partner of many years and still seem to expect butterflies and overwhelming excitement)? At the other extreme - is there neglect and abuse? Or are you just so deeply incompatible that there is a gulf between you and no real closeness and warmth?
Remember that your marriage is a model for your children and their expectations of marriage. Would you want them to have the marriage you've got? If they're growing up in a union where at least one party is "pretty miserable" most of the time, that seems sub-optimal to me. People talk about staying together for the children. Sometimes it may be better to leave for the children. You say your DS would be devastated but if you and your H are able to co-parent sensibly and constructively, it's not obvious why he should be devastated, particularly if you have a marriage which is making at least one of you miserable.
It does depend on how functionally you think you and your H could co-parent if you separated but if your DCs are of an age to be leaving home in about 6 years' time then they're old enough to make decisions about who they spend time with and make their own arrangements with him etc.
FWIW, some of the most functional families and most sorted children I know are families where the parents divorced and have co-parented sensibly and constructively. And, quite seriously, some of the most damaged and dysfunctional people I know grew up in marriages where the parents disliked each other but stayed together for the children.
There may be very good practical reasons why you think it is better to stay now. They may involve the children. But ultimately I don't think you should call it staying together for the children. It's an unfair and unreasonable burden to place on them. You could call it - staying together while we are raising our children because for various reasons it is easier for me if we remain together while we are raising our children. Those could be completely valid reasons for staying but I do think you should reframe your thinking that you're doing it for your children.