Software Engineer
Great Software Laboratory (GSLab)PHP developer
Earth Solution Private LimitedJira
.png)
Jenkins
I have more than 7 years of experience in, PHP Laravel and along with Python as well, MySQL and JavaScript.
Well, in one of our table locations, it has a huge data, like, 50 to 60,000 rows. So we have to optimize it. So for that, we have written stored procedure and done indexing on the on the columns. And while fetching the data, we have used group by and many other options. So that has, improved the speed of the data. Also, from point of view, we have used lazy loading.
well, I will use transactions, DB transactions. So in case if anything fails, I will roll back all the transaction. If anything goes well, I will commit the transaction. So this will happen data integrity.
Will you connect with the front end developers about what they want, what data they want? So, accordingly, you would then, you then structure that data in the same way. And, also, you need to understand how much, how much large is that dataset, whether you whether you have to send all the data at once or you can send the data in chunks.
So for that, we can use this caching Redis cache so far. So if I'm requesting a data, if there's so if let's say, an example, if there's data and I'm using API to fetch it, what I what I can do is I can use a cache. I can cache the, data so that will improve in the in the in the speed. So that will have an improvement in the speed. So say for example, if new data is inserted in the same table, so, I will I will clear the I will clear the cache, and that will help in up updating the data as well.
I have not implemented it, but other like this, singularity, like, other solid principles like dependency, inversion. I have I have used that, but not this, list cost of solution principle.
Well, what you can do is you can create a middleware as an as an abstraction layer and in that, you will have the header. So that way, that header so that way, that header will apply to all the all the all the rest APIs. Instead of, instead of writing here, it's better to create a different class and then use that class to implement it. That way, we can use that middleware on or that class anywhere in the in the application.
Well, in here, we have to use this parameterized video. Like, instead of directly writing this query, this is prone to MySQL injection. So instead, we should have parameterized, query and also we have to sanitize the data first like email. Like, we have to remove the tags. We have to remove any script tags.
Well, one of the use cases we have we had are already in the table. Like, it wasn't more one to one relationship. But later on, the data got so big, so we have to change the relationship. Already, that data was in the table. So what we do is we created we replicated the same table and used the one to many relationship in that.
So for that, you need to have the first thing. You need to exceptions. So in case if anything fails, the users should know. We can have, we can use events. So in case if anything failure happens also, if a cron job is running, it's better to, implement the Apache, airflow. So that is more resilient.
So firstly, what you can do all the you we need to cache all the static files. Okay. And then, we have to cache all the views and routes as well. So that way the application will be faster. And also, in the in the views, we have to load the CSS file first and after the page loads, then the JS. That way, it will speed up the application.
It completely depends upon the use cases. Like, if I have a query, like, if I have SQL query, whether that will, give me the result with ORM or that will give me the result with raw SQL. So it all depends upon the speed, how much time will it consume, and how much simpler will I write Will, do I have do I have all the options with Laravel or not?