At the Hajj pilgrimage, the world's largest Islamic gathering, which takes place in October, the authorities now use live crowd analytics software, which can not only spot problems in the crowd but also claims to be able to predict where overcrowding is likely to happen.
Live data feeds come into a large operations room where they are analysed by military personnel, the police and other crowd managers.
The software provides accurate and real-time data on crowd numbers, densities, distributions and flows.
"Crowds can be dangerous places. Whether triggered by factions within the crowd, by natural disasters or misguided crowd managers, there is a long history of crushes, stampedes and failed evacuations," said Fiona Strens who co-founded CrowdVision, the firm behind the software.
"It spots patterns of crowd behaviour that indicate potential danger such as high densities, pressure, turbulence, stop-and-go waves and other anomalies."
As large-scale events go the Hajj is one of the biggest and it has a pretty bad track record; over the years thousands of lives have been lost.
One of the worst incidents occurred in 2006 when a stampede on the last day of the pilgrimage killed at least 346 pilgrims and injured another 200.
Crowd behaviour
As part of his PhD research, CrowdVision co-founder Dr Anders Johansson analysed the CCTV images of the pilgrims before and during the crush in 2006, and realised that there were patterns of behaviours that, spotted early enough, could have prevented it.
In 2007, his system was installed in Mecca and it has been monitoring the pilgrimage every year since.
Muslim pilgrims
The Saudi authorities believe such technology helps save lives
While the company doesn't like to tempt fate, since its involvement, no fatalities have occurred.
That isn't entirely down to the technology though, admits Ms Strens.
"In recent years the Mecca authorities have invested in better infrastructure, planning and technology to assure pilgrim safety but we play a very important role providing the real-time data and insights needed to inform operational decision-making," she said.
For their part, the Saudi authorities are pleased to have such a technology partner.
"The live crowd analysis greatly improves safety of pilgrims," said Dr Salim al Bosta, crowd management expert, at the ministry of municipal and rural affairs.
But crowd scientist Keith Still, who was special adviser on the Hajj from 2001 and 2005, is more sceptical about how much technology can help in such places.
"Any technology has to be coupled with a crowd management plan," he told the BBC.
In fact he thinks that technology installed at the Hajj in 2006 - before CrowdVision's involvement - actually contributed to the tragedy that unfolded.
"Tech firms offered the Saudis new systems and there was an over-reliance on technology. There was lots of digital signage put up to direct the crowds but it was just a mess," he said.
He is also sceptical about whether the technology used by CrowdVision can work in a live situation.
"It spots shockwaves in the crowd but if these are happening then you are already at a point where people could be crushed or seriously injured. Whoever is in control has fundamentally lost control of the situation by then," he said.
"It could become an exercise in futility."
For him, the value of CrowdVision lies more in its ability to precisely count how many people are at an event.
"If you need to track capacity such tools are great but it is a long way away from being a risk management system," he said.
http://www.bbc.co.uk/news/technology-24463736As well as being boring it seems Mecca is also very dangerous!