Nasserismo, I question whether it is possible to modernize a military in a vacuum without modernizing the rest of the economic and political system. Russia attempted it during the 18th and early 19th Century and could only take military modernization so far while retaining serfdom. The Japanese did not even want to try for a few hundred years, which was why they imposed seclusion on their country for as long as they judged it safe to do so. Then they modernized everything at once.
The Ottomans will have particular difiiculty modernizing because of the problems that David Price-Jones identifies in his book "The Closed Circle". See articles.latimes.com/.../bk-3556_1_arab-world-arab-psyche-arab-behavior
The problem, as Price-Jones sees it, is that in the Middle East, the tribe is the unit of social behavior and identity. Political behavior is determined by blood relationship and one's position within one's tribe. This leaves little room for abstract concepts such as professionalsim or merit to govern things like bureaucratic or military appointments. And if the Ottoman Empire is to truly modernize, this is what it is up against. It must literally reconquer itself from Istanbul outward. And it will have an easier time in Europe, paadoxically where this "closed circle" is less of an issue than in Anatolia and less of an issue in Anatolia than in the Middle East south of Anatolia.
In fact, this is why the Sultan abolishes the Janissaries at his own peril. The Janissaries are quite literally the only force in the Empire that is not beholden to one tribe or another. Rather than abolishing them, he needs to use them more effectively and mold them into his oprichniki, or secret police and intelligence force to use Ivan IV Grozny's term.
And the real paradox is that Persia under the Safavids can probably assimilate the Enlightenment much more easily than the Ottoman Empire can because of the structure of Shia Islam. Because Shia Islam bases it's authority on a hierarchy of mullahs and immams who are headed up by a council of Experts or Mujtahids also known as Ayatollahs (literally Reflection of Allah) , these Mujtahids will be listened to by the people when they issue religious fatwas mandating reforms. For a Shia believer, a mujtahid is his marja i taqlid or "object of imitation". If his marja-i-taqlid speaks, he will listen and generally obey.
And Shia mujtahids have the right to ijtijhad or innovation in Islamic law. In Sunni jurisprudence, the door to ijtihad was closed around the 10th Century.
So if a Safavid Shaanshah goes to the ulema and says "these reforms are necessary for the good of the kingdom and Islam" and the mujtahid, the Grand Ayatollah agrees and issues a fatwa, the Shah stands a much greater chance of getting his reform fully implemented by the people than an Ottoman Sultan does. And in the 17th or 18th century, the reforms the Shah will be asking for will be a lot more modest and incremental; things like civil service and a professional military and an end to nepotism rather than women's rights, than they would be in the 20th Century IOTL. So in a hyothetical race to Enlightenment and reform, paradoxically, Persia would have am advantage over both the Ottoman Empire and the Muhgal Empire despite the larger size and more direct contact with the West of the latter two simply because it possesses a unique authority structure that makes it easier to sell reform at the grassroots level should the King be able to avail himself of it.