Support

Home Forums Event Espresso Premium Number of Datetimes/Tickets per event & number of database queries – EE4

Number of Datetimes/Tickets per event & number of database queries – EE4

Posted: January 24, 2017 at 6:19 am


Sjoukje Oostindie

January 24, 2017 at 6:19 am

There seems to be a problem with editing a single event when there are a ‘large’ number of Datetimes/Tickets. The page does not fully load (the full HTML is not loaded) and the event datetimes/tickets are missing.

After many hours of research and modifying server settings it became apparent that the number of queries might be the problem. I installed a plugin (Query Monitor) that tracks the number of queries per page as well as memory usage.

We have at the moment 4 events with varying numbers of Datetimes and Tickets:

Event 1 has 4 Datetime and 4 Tickets
Event 2 has 18 Datetimes and 18 Tickets
Event 3 has 37 Datetimes and 37 Tickets
Event 4 has 57 Datetimes and 57 Tickets

Beginning with Event 1, editing this event presents no problems with the current server settings. It loads quite quickly. However, even with only 4 Datetimes and 4 tickets the number of queries is very high – 255 queries. As a baseline, the WordPress dashboard uses 194 queries most of which come from the caller get_option() which can be traced back to at least 80 queries from event-espresso-core-reg – 4 of which are duplicate queries. My conlclusion here is that Event Espresso uses an inordinate number of queries even on pages that have nothing to do with events (i.e. the dashboard).

If I try and edit Event 2 – with only 18 datetimes/tickets – I get the following error:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 313403 bytes) in /home/adutchexpe/domains/adutchexperience.com/public_html/dev/wp-content/plugins/event-espresso-core-reg/caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php on line 972

This message follows when the WP_MEMORY_LIMIT is set to 256M. As a test I then temporarily set the memory limit to 512M. Editing the same event succeeds after more than 60 seconds. However, the memory required for this page is 275MB and the number of queries is now an astronomical 5072!!! – 64 of which seem to be duplicates.

Needless to say, Event 3 and Event 4 take too many resources to open. I do not want to break our server by trying.

As reported in the features section of Event Espresso – Unlimited Datetimes per Event. This may be true, but unlimited datetimes and tickets leads to an abudance of queries. It also seems that the relationship between number of datetimes/ticket and queries is geometrical: 4 datetimes/tickets = 256 queries : 18 datetime/tickets = 5072 queries.

I sincerely hope this can be resolved because the site is in principal complete and our entire business is dependent on Event Espresso using multiple datetimes and tickets per event due to the absence of a recurring events plugin.

More information:

Wordpress:

Current version 4.7.1
All plugins and themes are up-to-date
Regarding WordPress plugins, etc. this problem can be reproduced with all other plugins deactivated and using the twentysixteen theme.

Server settings:

PHP version – 5.6.29
max_input_vars = 10000
max_execution_time = 120
query_cache_type = 1
query_cache_limit = 1M
query_cache_min_res_unit = 4k
query_cache_size = 80M
thread_cache_size = 50

Active Event Espresso plugins:

Event Espresso Core – 4.9.26.p
Event Espresso – Calendar (EE 4.3+) – 3.2.8.rc.001
Event Espresso – Grid View Template (EE 4.4.9+) – 1.2.3.p
Event Espresso – Events Table View Template (EE 4.4.9+) – 1.3.5.p
Event Espresso – iDeal Mollie Gateway (EE 4.6.15+) – 1.1.4.p
Event Espresso – MailChimp (EE4.4.5+) – 2.3.4.p
Event Espresso – Social Sharing (EE4.4.4+) – 1.0.p

If needs be I can set up a user account for access to the site.

Sincerely,
Jason Jeffers
Developer – A Dutch Experience


Josh

  • Support Staff

January 24, 2017 at 8:59 am

Hi Jason,

As you may have already concluded, you’ll need to either reduce the number of tickets and date times per event, or increase the memory limit and max_input_vars limit for the server to be able to handle that many ticket options in the editor.

If you want to discuss this further with the development team, you can open a github issue here:

https://github.com/eventespresso/event-espresso-core/issues


Sjoukje Oostindie

January 24, 2017 at 10:16 am

Hey Josh,

In order to process the existing datetime/ticket combinations – currently up to 50 – we would need to allocate over 1024MB of memory and our host would not be happy with us. Even then, editing the events would be a nightmare just waiting for them to load. So this isn’t a solution.

I am sure this has been answered many times before, but I would really appreciate a succinct explanation of how to achieve what we need. The answer may include ‘downgrading’ to EE3 for recurring events. So here goes:

We offer events every day of the week for at least 3 months of the year. And these events take place both in the morning and afternoon – two datetimes per day. Therefore we need let’s say 120 datetimes. We assumed, wrongly, that we would create as many tickets and assign them to the datetimes – selling one ticket per datetime. So if 120 tickets is out of the question, how can we sell a single ticket that corresponds with a single datetime. As I have read the documentation (a number of times) a single ticket attached to multiple datetimes allows the registrant access to all datetimes. This is not desirable. Simply put, we need one ticket per single datetime. Can this be achieved and how?

Perhaps related, but is there a way to have a single ticket and the user can then choose which datetime the ticket belongs to in for example, a dropdown?

Or are what we trying to do not possible in EE4? Or is it possible in EE3?

We were planning on going live with the site the first of February – next week – having started in the middle of November. We only came across this problem when actually entering real datetimes/tickets last Friday. Needless to say this is a major problem for us.

Thanks in advance for any advice or solutions.

Jason


Josh

  • Support Staff

January 24, 2017 at 10:56 am

Hi Jason,

Instead of setting up one event with 120 date times, you could go with something like 4 events with 30 date times.


Sjoukje Oostindie

January 24, 2017 at 11:57 am

Hey Josh,

Ha! That’s exactly what I thought of and just got off the phone with my client. Unfortunately, this doesn’t work. The reason being that she needs to show the available dates over a longer period. So, for example, if we went live in February then all the available datetimes need to be visible for the next 6 or more months in a single event calendar. Her target audience books events months in advance. If we split the events up then the client wouldn’t see the events in a later period; datetimes from the second, third or fourth split event as it were.

Would downgrading to EE3 and using the recurring events plugin help this situation? And if so, I notice on the site that if you look at the pricing matrix for EE3 and click on the 26 premium add-ons that some are prefixed with EE4. Do these add-ons work with EE3? The reason I ask is that we require and use the iDeal payment gateway plugin (We’re in Holland).

We need to make a decision tomorrow as to a solution to get this up and running because there are many people counting on this site and the promise has been made to be live next Wednesday.

Thanks again for any advice.

Jason


Josh

  • Support Staff

January 24, 2017 at 1:17 pm

If we split the events up then the client wouldn’t see the events in a later period; datetimes from the second, third or fourth split event as it were.

What I would suggest is you set up a category for like events, then the client can view all of the like events in the category archive. They can even register for more than one event at a time if you install the Multi Event Registration add-on.

I notice on the site that if you look at the pricing matrix for EE3 and click on the 26 premium add-ons that some are prefixed with EE4. Do these add-ons work with EE3?

EE4 add-ons work only with EE4. They cannot be used with EE3.


Sjoukje Oostindie

January 24, 2017 at 3:31 pm

Josh,

Unfortunately, none of the suggestions are workable for our situation. However, I have come up with my own solution that may be helpful to others:

Set up per event multiple datetimes and a single ticket. Then, in the registration page I have set up as a test two question inputs 1) a dropdown with available dates and 2) a datepicker to choose available dates. The dropdown is problematic in so far as each event needs a long list of dates which is not easily maintainable and not particularly user friendly. The datepicker is also problematic because I need to output a list of the dates associated with the event in the registration page to use with my own custom datepicker javascript – highlight the available dates and restrict the datepicker input field value to only highlighted dates on click. The javascript is fairly straightforward. However, I cannot find a way to pull in the available dates in the single page registration form which uses page.php as it’s template. Can you suggest the best way to output the event dates (or datetimes) in page.php or in the registration page template itself. I tried the template tag espresso_list_of_event_dates() in page.php but it returned the following message: There are no upcoming dates for this event. This didn’t work probably because I’m missing some sort of global or helper.

As usual, any help is appreciated.

Cheers,
Jason


Sjoukje Oostindie

January 25, 2017 at 3:58 am

Josh,

I see my problem now –

espresso_list_of_event_dates()

requires the event ID. However, and here is the rub, after hours of research I cannot find a way to determine the event ID within the registration/checkout form code. I have tried many hooks in functions.php such as “AHEE__SPCO__after_registration_steps”, but I cannot pull in the event ID. I tried the code found in this post GET attendee information on registration form page but it did not return the event ID. Any help at this point is appreciated.

Cheers,
Jason


Josh

  • Support Staff

January 25, 2017 at 7:28 am

Hi Jason,

I can point you in the direction of how to get the event ID while on the checkout page, but I will let you know that what you’re attempting is not supported. You can get the $event object like this:

if ( $checkout instanceof EE_Checkout ) {
    $transaction = $checkout->transaction;
    if ( $transaction instanceof EE_Transaction ) {
        foreach ( $transaction->registrations() as $registration ) {
            if ( $registration instanceof EE_Registration ) {
                $event = $registration->event();
                if ( $event instanceof EE_Event ) {
                    // you have the $event object now
                }
            }
        }   
    }
}


Sjoukje Oostindie

January 25, 2017 at 7:59 am

Josh,

After 15 hours yesterday and a sleepless night we have decided that this solution will not work for us. We have gone back to creating as many datetimes and tickets as the server can handle. I have spent all day creating datetimes and tickets and checking the resources required. At this point I can create 38 datetime/ticket combinations for a single event which takes 80 seconds to load, 230MB memory and 3,734 queries. This is now our limit. And with this limitation we cannot show all the datetimes in the future that we need. However, we need to go live with this site and will work on a more permanent solution at a later date – more than likely using a different event plugin.

Also, using the very handy plugin Query Monitor, I can see that many of these queries are duplicates. It might behoove you to make the developers aware of the huge amount of queries and possible duplicates. Hopefully a dramatic reduction in queries can improve not only our situation, but others who are in a similar situation.

As a side note: I have read that a number of people are disappointed with the way the datetimes and tickets work for situations such as ours – a situation that is not uncommon. I have also read the reasoning behind it. However, I would recommend that you make it more clear on the site that there is in fact a physical limit to the number of tickets per event because of the imho outrageous number of queries generated by the coupling of datetimes and tickets. The site clearly states that an event can have ‘unlimited’ datetimes giving a normal reader the impression that these can be coupled with unlimited tickets.

I do thank you for all your help.

Sincerely,
Jason


Josh

  • Support Staff

January 25, 2017 at 8:16 am

If you have any ideas on how to reduce the number of queries to make all of that possible, the developers would love to hear them. You can share your ideas in a github issue if you are so inclined:

https://github.com/eventespresso/event-espresso-core/issues

The support post ‘Number of Datetimes/Tickets per event & number of database queries – EE4’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso